[comp.sys.atari.st] GEM question

foster@ihuxv.ATT.COM (r. foster) (12/30/88)

I am having a problem with using a dialog box that I was wondering
if someone has the answer to. The program sequence I am using goes like
this:

form_center(tree,&cx,&cy,&cw,&ch);
form_dial(FMD_START,cx,cy,cw,ch,0,0,0,0);
objc_draw(tree,0,MAX_DEPTH,cx,cy,cw,ch);
SHOW_MOUSE
setnum=-1;
do {
	n=form_do(tree,SETSEL);
	switch (n) {
		case SET0:
		case SET1:
		case SET2:
		case SET3:
			strcpy(s1,selptr[n]->te_ptext);
		/*	tree[n].ob_state &= ~SELECTED;  Return to normal */
			HIDE_MOUSE
			objc_draw(tree,SETSEL,0,cx,cy,cw,ch); 
			SHOW_MOUSE
			break;
			etc.


The form consists of several BOXTEXTs (SET0-3) which are marked as
SELECTABLE and EXIT in the resource. The problem that I am having is
that when I select one of the BOXTEXT objects with the mouse, the
box reverses as it should except for the small rectangle under the
mouse. Multiple selects keep leading to ever more checkerboarded
boxes. This condition exists immediately upon selection, in other
words, it exists on the screen at the return from the form_do.
This obviously doesn't happen on most people's programs so
why does it on mine? Is there something that I have forgotten or that
I am doing out of sequence?

One other question: How do you find the name of the program you are
running under GEM? Under a shell, it comes in argv[0] but that isn't
set when starting from GEM.

Any help would be appreciated!

Thanks,

Bob Foster

kens@atari.UUCP (Kenneth Soohoo) (12/31/88)

In article <3092@ihuxv.ATT.COM> foster@ihuxv.ATT.COM (r. foster) writes:
>I am having a problem with using a dialog box that I was wondering
>if someone has the answer to. The program sequence I am using goes like
>this:
>
>form_center(tree,&cx,&cy,&cw,&ch);
>form_dial(FMD_START,cx,cy,cw,ch,0,0,0,0);

	You should hide your mouse before doing an objc_draw().

>objc_draw(tree,0,MAX_DEPTH,cx,cy,cw,ch);
>SHOW_MOUSE
>setnum=-1;
>do {
>	n=form_do(tree,SETSEL);
>	switch (n) {
>		case SET0:
>		case SET1:
>		case SET2:
>		case SET3:
>			strcpy(s1,selptr[n]->te_ptext);
>		/*	tree[n].ob_state &= ~SELECTED;  Return to normal */
		Why's this commented out?
>			HIDE_MOUSE
>			objc_draw(tree,SETSEL,0,cx,cy,cw,ch); 
>			SHOW_MOUSE
>			break;
>			etc.
>
><<Some deleted>> The problem that I am having is
>that when I select one of the BOXTEXT objects with the mouse, the
>box reverses as it should except for the small rectangle under the
>mouse. Multiple selects keep leading to ever more checkerboarded
>boxes. 

	Well, if this ain't it, you must be mixing graf_mouse() and
some other version of mouse on/off like v_show_c() v_hide_c(). When you
use these two functions, you should pick one and stick to it, don't
mix them, or GEM get's confused...

	Also, if you forgot to hide your mouse _anywhere_ in the program,
you can end up with problems like these.  AND if you don't reset GEM after
confusing it (i.e. you're in a shell and don't exit to the desktop) GEM
can continue to be very confused and you my never be able to see that
you fixed your bug :-).
-- 
Kenneth Soohoo			{ames,imagen,portal}!atari!kens
Atari Engineering
"So Atari doesn't necessarily agree with me, so what!"