Page 1 of 1
SetGadget* sends an event?
Posted: Wed Sep 17, 2003 8:38 am
by Seldon
I would like to know if it's normal that a SetGadget call (SetGadgetState, SetGadgetItemText, etc...) produces an event to the interested gadget. I mean after SetGadget is called, I get an event for the gadget has been set. Since I use this in a program of mine, I wanted to be sure it isn't a bug or something will change in future. Thanks.
Posted: Wed Sep 17, 2003 9:28 am
by Fred
Yes, some SetGadgetXXX() sends an event. I'm thinking about it if it shouldn't be removed, as it shouldn't do it IHMO.
Posted: Wed Sep 17, 2003 6:22 pm
by Karbon
I just saw this last night and was getting ready to ask this myself. I don't think it should send an event either (IMHO!)...
Posted: Thu Sep 18, 2003 6:57 am
by Seldon
To send or not to send, this is the question. Well.. if it's involved Windows itself (something with SendMessage API, I guess) it should stay. Another important thing to know if people does use such feature or not, as it could be annoying to break compatibility. I don't know if that would be possible, what about a compiler option or a command to switch it?
Though it can be useful to write smarter code. For example I have a button gadget that opens a path requester. After the choice, I set a string gadget with the returned path (so the user can always sees it). When I set the string gadget, the string gadget receives an event so I make things happen then. And if the user changes the path manually (that is editing the string gadget) the same event is generated, so I use the same code.
If the event trapping routine is a callback, some kind of recursive function could also be used, etc...