CompuServe Thread

String Gadgets HELP!

4 messages in this thread
#30284From: Wayne DyerNov 21, 1992 3:23 PM
Hi! I have a problem with string gadgets. I'm using SAS/C 5.10b (6.0 is in the mail still) and need to know basically how to get the StringInfo. I'm using only GADGETUP in the window, and using ((struct StringInfo *)g->SpecialInfo)->Buffer via the GadToolsBox-generated code to get the string based on the GadgetID, doing strcpy(mystruct.string,/*above line of code here*/); Problem is, I get strange results if I have the tab cycle set, and tab between string gadgets. Is there something I'm missing here? I know the strcpy() function is OK, because mystruct.string is bigger then the max num. of chars in the buffer by a long shot. Anyone care to take a shot? Do I need GADGETDOWN? -W-
#30982From: Jonathan PotterDec 23, 1992 10:10 PM
No you shouldn't need GADGETDOWN. The code fragments you have posted seem fine; as far as I know, the only difference between exiting a string gadget via the tab key and with the return key is that tab will set the IntuiMessage->Code field to 0x9. When you say strange results, what exactly is happening ? Jon
#31094From: John Toebes/SYSOPDec 29, 1992 11:21 PM
One general comment that you need to be aware of. You can NOT access the string info UNLESS you remove the gadget. Usually this will work, but there are times where it can get messed up. So, the correct sequence would be something like: oldpos = RemoveGList(window, gadget, 1); strcpy(buf, ((struct StringInfo)gadget->SpecialInfo)->Buffer); AddGList(window, gadget, oldpos, 1, NULL); Beside this, I am not sure what is happening. Could you give a better description of what is occuring?
#31308From: Wayne DyerJan 8, 1993 9:32 PM
As to what is/was happening, I can't actually recall because I seen to have fixed it. (seem, that is) A -lot- of things have happened 'round the house since I last posted, and I ended up trashing the old code and starting from scratch (which was subsequently placed in limbo due to hard drive problems and I need to do a little necromancy to extract things from corrupted backup disks <sigh> Anyway, the tip about removing the gadget before getting the info is new to me. I've been getting the info like you showed after the GADGETUP message but leaving the gadget in the list. I'll see about adding that when I fully recover up here…:-)