Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to know code is running when firing timer event
Message
 
To
28/12/2011 11:20:28
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01530700
Message ID:
01531845
Views:
135
I understand now. Thanks a lot for your explanation!

Ben


>>I still don't understand. When a modal form is activated, g_WaitCode>0 is always true no matter the form's method code is running or not.
>>
>>Ben
>>
>
>Sorry, I put little attention
>
>
>* on Timer Event
>IF PROGRAM(-1)>m.g_WaitCode+1
>            * a VFP line code is running
>ELSE
>           * Stand Alone event
>ENDIF
>
>
>>
>>>>Hi Fabio,
>>>>
>>>>Frankly speaking, I don't understand. Can you explain why?
>>>>
>>>>Looking at your code, g_WaitCode is always larger than 0 no matter method code is running or not.
>>>>
>>>>Ben
>>>>
>>>
>>>The public g_WaitCode shoud to be set to 0 when the application start.
>>>
>>>PUBLIC g_WaitCode
>>>g_WaitCode = 0
>>>
>>>
>>>it go to 1 before to call a Modal form and return to zero when the modal form go out.
>>>If modal call another modal it become 2 and return 1 ....
>>>
>>>javascript:document.Form1.submit()
>>>>
>>>>>>Fabio,
>>>>>>
>>>>>>After adding the counter, how can I detect if the timer is firing between 2 lines of the method code of a modal form?
>>>>>>
>>>>>>Ben
>>>>>>
>>>>>
>>>>>* on Timer Event
>>>>>IF m.g_WaitCode>0
>>>>>            * a VFP line code is running
>>>>>ELSE
>>>>>           * Stand Alone event
>>>>>ENDIF
>>>>>
>>>>>>
>>>>>>
>>>>>>>>Fabio
>>>>>>>>
>>>>>>>>Thanks for your suggestion. However when an modal form is on top, the stack level is higher than 1.
>>>>>>>>I want the time code runs no matter a modal form or a modaless form is on top, but not between code lines.
>>>>>>>>Will it be possible to do it?
>>>>>>>>
>>>>>>>>Ben
>>>>>>>>
>>>>>>>
>>>>>>>AFAIK with native VFP behaviour NO.
>>>>>>>
>>>>>>>You can workaround every middle code waiting with a public counter or _SCREEN.property
>>>>>>>and remove the counter from the PROGRAM(-1)
>>>>>>>
>>>>>>>
>>>>>>>g_WaitCode = m.g_WaitCode +1
>>>>>>>READ EVENT
>>>>>>>g_WaitCode = MAX(m.g_WaitCode -1,0)
>>>>>>>
>>>>>>>****************************************
>>>>>>>g_WaitCode = m.g_WaitCode +1
>>>>>>>* create a modal form
>>>>>>>g_WaitCode = MAX(m.g_WaitCode -1,0)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>Check if the timer event fires between two lines on execution is not a good way.
>>>>>>>My real suggestion is to change the way to get to do what you want to do.
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>>How can I know if some VFP code is still running when a timer event is fired?
>>>>>>>>>>
>>>>>>>>>>TIA
>>>>>>>>>>Ben
>>>>>>>>>
>>>>>>>>>vfp uses a common stack,
>>>>>>>>>then check stack level
>>>>>>>>>
>>>>>>>>>IF PROGRAM(-1)>1
>>>>>>>>>....
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>If Timer event run at level 2 or more then the event is fired between 2 running lines.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform