04-09-2013 08:11 AM
Hi,everybody.
I'm wondering why my program like this didn't work while I know the way it work.
I just wanna know how the regist dymamic event works
--------------------------------------------------------------------------------------------------------------------
When my program is written like this
the event "value change" is triggered once , and the interface is then dead, with no response to mouse or kBoard.
(the time-out frame is still working, only interface is dead)
When I change the program like this:
It works fine.
And When I do this
It also works well.
So
---------------------------------------------------------------------------------------------------------------------------------------------------
I want to know why in the first condition there is problom.
how the regist dymamic event works???????
Thank you.
----------------------------------------------------------------------------------------------------------------------------------------------------
Thougn my LB version is chinese, I think you know what I'm saying.
Neko
04-09-2013 09:18 AM - edited 04-09-2013 09:20 AM
I did not code this up for testing (so take this with a grain of salt if I am wrong), but to me I would guess the following:
2nd case: event registered once outside the while loop. Should work as intended.
1st case: event registered OK first time through the loop so should work once. Second time through the loop event is re-registered so I am assuming since it already exists an error is thrown and now you are wiring up an invalid event to the structure (which will likely override the original)
3rd case: event is registed and unregistered each time. Should work OK but inefficient.
I would probe the event reference in the 2nd case and see what is passed to the event structure after the first event
04-10-2013 06:56 AM
Thank you, Don.
I think it is beacause a handle is created but not closed, while the new handle gives the control a new handle.
So the old ones still responses the event but can not find the indicator and this will cause a dead interface,
I found it in LB help ,there's some similar hint "If you don't close a registed handle after the while loop but still produce event, the Interface is then dead."
=.=~ hohohoho