Forum unknown
· Programming
#ActivateGadget()
5 messages in this thread
I've been trying to use ActivateGadget with no success at all. I'm
attempting to activate a string gadget in a requester. The requester
contains 3 gads, 2 bool and the string. the bools are linked with the
string the last in the chain. I've tried using the pointer to both the
first bool and the string in Activateg.. and it doesn't work, returns NULL.
Any possible answers?
While I can't tell you why I think this will work (think I heard it
somewhere quite awhile ago), how about trying a short delay between the
time you open the requester and the ActivateGadget() call? I believe that
the ActivateGadget call will fail under several varied conditions, one of
which is that a window (other than the one containing the gadget) is
active. If you wait until the requester window is actually activated,
possibly the Activate will succeed. I'd stick in a big delay to test, say
a Delay(50). If that doesn't work, then no amount of delay will, and you
can just forget I mentioned this. <grin>
While I can't tell you why I think this will work (think I heard it
somewhere quite awhile ago), how about trying a short delay between the
time you open the requester and the ActivateGadget() call? I believe that
the ActivateGadget call will fail under several varied conditions, one of
which is that a window (other than the one containing the gadget) is
active. If you wait until the requester window is actually activated,
possibly the Activate will succeed. I'd stick in a big delay to test, say
a Delay(50). If that doesn't work, then no amount of delay will, and you
can just forget I mentioned this. <grin>
With a requester gadget, you need to do a Delay(about_5L) before calling
ActivateGadget, because the call to Request() returns before the gadget is
really set up. If you stick in the delay it should work. Be careful (test
a lot) with ActivateGadget in a string gadget-I had lots of problems of
interaction with DOS causing GURUS. Do things like popping diskettes out
right before opening the Request when testing. You CAN get it to work
bug-free, but there are some lurking gotchas.
With a requester gadget, you need to do a Delay(about_5L) before calling
ActivateGadget, because the call to Request() returns before the gadget is
really set up. If you stick in the delay it should work. Be careful (test
a lot) with ActivateGadget in a string gadget-I had lots of problems of
interaction with DOS causing GURUS. Do things like popping diskettes out
right before opening the Request when testing. You CAN get it to work
bug-free, but there are some lurking gotchas.