pasturel@sctc.com (Pierre Pasturel) (11/21/90)
I am getting the following X toolkit warning: X Toolkit Warning: Name: text5 Class: XmText Invalid margin height, must be >= 0. after the following piece of code has been executed several times in a loop: XtSetArg (args[0], XmNvalue, temp_holder_two); XtSetValues( LOCKtoTPT_Text, args, 1); where temp_holder_two is an array of 71 characters which never contains newlines (if that makes a difference), only reg. alpha-numeric characters and an occassional ^M (carriage return character) and where LOCKtoTPT_Text is an XmText widget created as follows: n = 0; XtSetArg (args[n], XmNcolumns, 70 ); n++; XtSetArg (args[n], XmNmarginHeight, 3 ); n++; /* default */ XtSetArg (args[n], XmNeditMode, XmSINGLE_LINE_EDIT); n++; XtSetArg (args[n], XmNeditable, FALSE); n++; XtSetArg (args[n], XmNcursorPositionVisible, False); n++; XtSetArg (args[n], XmNfontList, fontlist6x12); n++; LOCKtoTPT_Text = XmCreateText (line, "text5", args, n); I inserted the following code after the XtSetValues to find out the value of the marginHeight resource: XtSetArg (args[0], XmNmarginHeight, &margin_height); XtGetValues( LOCKtoTPT_Text, args, 1); printf("text5.marginHeight: %d\n",margin_height); and I got the following output for several iterations of the loop: text5.marginHeight: 15 text5.marginHeight: 23 text5.marginHeight: 31 text5.marginHeight: 39 text5.marginHeight: 47 text5.marginHeight: 55 text5.marginHeight: 63 text5.marginHeight: 71 text5.marginHeight: 87 text5.marginHeight: 95 text5.marginHeight: 103 text5.marginHeight: 111 text5.marginHeight: 119 text5.marginHeight: 127 text5.marginHeight: 135 text5.marginHeight: 143 text5.marginHeight: 159 text5.marginHeight: 167 text5.marginHeight: 175 text5.marginHeight: 183 text5.marginHeight: 191 text5.marginHeight: 199 text5.marginHeight: 207 text5.marginHeight: 215 and so on...., starting at 15 (why?) and always increasing by 8. The value probably eventually execeeded 2^^16 (the resource's type is a short int) and at which point I get the X toolkit warnings, which slow my application down and fills up my xterm from which I started the application. Any ideas what might be causing this problem?? What am I doing to increase this resource value and how can I prevent it so I don't get the zillions of warning messages?? Thanks In Advance Pierre pasturel@sctc.com
pasturel@sctc.com (Pierre Pasturel) (11/21/90)
I'd rather solve the problem I'm having with the marginHeight resource, but if no one has a solution, is there at least a way to suppress X toolkit warning messages?? Pierre pasturel@sctc.com
pasturel@sctc.com (Pierre Pasturel) (11/22/90)
I did a little more investigating. I created an XmText widget, as described in my earlier posting, and after it is managed, I put the following code: #ifdef DEBUG for ( i = 0; i<= 10; i++ ) { XtSetArg (args[0], XmNmarginHeight, i); XtSetValues( LOCKtoTPT_Text, args, 1); printf("XtSetValues set XmNmarginHeight to %d\n",i); XFlush(display_ptr); XtSetArg (args[0], XmNmarginHeight, &margin_height); XtGetValues( LOCKtoTPT_Text, args, 1); printf("XtGetValues retrieved XmNmarginHeight as %d\n",margin_height); } printf("**************\n"); for ( i = 0; i<= 10; i++ ) { XtSetArg (args[0], XmNvalue, "testing 1 2 3" ); XtSetValues( LOCKtoTPT_Text, args, 1); printf("XtSetValues set XmNvalue.\n"); XFlush(display_ptr); XtSetArg (args[0], XmNmarginHeight, &margin_height); XtGetValues( LOCKtoTPT_Text, args, 1); printf("XtGetValues retrieved XmNmarginHeight as %d\n",margin_height); } #endif where LOCKtoTPT_Text is a XmText widget. and I get the following output: XtSetValues set XmNmarginHeight to 0 XtGetValues retrieved XmNmarginHeight as 8 XtSetValues set XmNmarginHeight to 1 XtGetValues retrieved XmNmarginHeight as 9 XtSetValues set XmNmarginHeight to 2 XtGetValues retrieved XmNmarginHeight as 10 XtSetValues set XmNmarginHeight to 3 XtGetValues retrieved XmNmarginHeight as 11 XtSetValues set XmNmarginHeight to 4 XtGetValues retrieved XmNmarginHeight as 12 XtSetValues set XmNmarginHeight to 5 XtGetValues retrieved XmNmarginHeight as 13 XtSetValues set XmNmarginHeight to 6 XtGetValues retrieved XmNmarginHeight as 14 XtSetValues set XmNmarginHeight to 7 XtGetValues retrieved XmNmarginHeight as 15 XtSetValues set XmNmarginHeight to 8 XtGetValues retrieved XmNmarginHeight as 16 XtSetValues set XmNmarginHeight to 9 XtGetValues retrieved XmNmarginHeight as 17 XtSetValues set XmNmarginHeight to 10 XtGetValues retrieved XmNmarginHeight as 18 ************** XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 26 XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 34 XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 42 XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 50 XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 58 XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 66 XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 74 XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 82 XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 90 XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 98 XtSetValues set XmNvalue. XtGetValues retrieved XmNmarginHeight as 106 There seems to be two things going wrong here. First, XtGetValues is retrieving a value 8 bigger than the value set by XtSetValues. But my main conern is in the second loop, where the setting of the XmNValue resource appears to effect the marginHeight value retrieved by XtGetValues(). Funny thing, though, is that there is no effect on the appearence of the XmText widget (i.e., the distance between the top and bottom border of the text widget and the text itself does not reflect the every increasing marginHeight resource value). Seems to me that there is a problem with the X Toolkit XtGetValues?? The only reason that this whole thing is a problem for me is that eventually I get all these X toolkit messages warning me that my margin height has to be >= 0. All these warnings slow down my motif application program simulation and it does not look good. I tried countering this problem by always resetting the marginHeight resource anytime I changed XmNvalue using XtSetValues. But this resulted in the XmText text flickering too much on the screen. Pierre pasturel@sctc.com
slh@wolf.cs.washington.edu (Scott Heyano) (11/22/90)
In article <1990Nov20.204225.23831@sctc.com> pasturel@sctc.com (Pierre Pasturel) writes: |I am getting the following X toolkit warning: | |X Toolkit Warning: | Name: text5 | Class: XmText | Invalid margin height, must be >= 0. | |after the following piece of code has been executed several times in |a loop: | |XtSetArg (args[0], XmNvalue, temp_holder_two); |XtSetValues( LOCKtoTPT_Text, args, 1); | |where temp_holder_two is an array of 71 characters which never contains |newlines (if that makes a difference), only reg. alpha-numeric characters and |an occassional ^M (carriage return character) | |and where LOCKtoTPT_Text is an XmText widget created as follows: | | n = 0; | XtSetArg (args[n], XmNcolumns, 70 ); n++; | XtSetArg (args[n], XmNmarginHeight, 3 ); n++; /* default */ | XtSetArg (args[n], XmNeditMode, XmSINGLE_LINE_EDIT); n++; | XtSetArg (args[n], XmNeditable, FALSE); n++; | XtSetArg (args[n], XmNcursorPositionVisible, False); n++; | XtSetArg (args[n], XmNfontList, fontlist6x12); n++; | LOCKtoTPT_Text = XmCreateText (line, "text5", args, n); | [stuff] | | and so on...., starting at 15 (why?) and always increasing by 8. | |The value probably eventually execeeded 2^^16 (the resource's type is a |short int) and at which point I get the X toolkit warnings, which slow |my application down and fills up my xterm from which I started the |application. | [more stuff] If in part what you are asking (which I doubt) is "Why do I get the toolkit error." that's because the marginHeight value is rolling over into the negative domain. Why the marginHeight value is getting changed, I don't know, but you might try not putting in the ^M, they might be screwing up the single-line-edit mode.