Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Starting Modal Form from ActiveX-Method
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00055284
Message ID:
00056930
Views:
29
From my tests, even an interval of 100-200 may give some problems. (BTW, in VFP3 the smallest real interval is about 0.055 seconds.) An other work around to disable a timer that is supposed to fire only one time:

*-- In the Timer event
IF NOT This.Enabled
RETURN
ENDIF
This.Enabled = .F.
*--Your code goes here

This is an ugly and "weird" work around, but it works (or, at least, I couldn't break it.)

Vlad

>Hi Paul!
>
>In VFP5 you should set the Interval to something a little greater then what was described in my tip. Something like Interval=100 or Interval=200 should do the trick. In this case the form comes up with a 1/10 of a second delay which should be fine.
>
>Greetings
>Markus
>EPS Software
>
>PS: DoEvents won't do anything in this case since it doesn't deal with OLE blocks.
>
>>I haven't read this tip (I think I'm late with one issue of FoxPro Advisor). I think this tip should work fine in VFP3. In VFP5, the Timer event will be fired for 50-300 (depending on how powerful and loaded is the computer) until it is disabled even if you have (This.Enabled = .f. in the Timer event).
>>
>>The fix to this problem in VFP5: replace This.Enabled = .f. with Release This. This is the only way to realy stop a Timer with a very short interval in VFP5.
>>
>>Vlad
>>
>>>Markus Egger just had a tip in FoxPro Advisor on this. The problem is in the event model of VFP. An internal flag is set whenever a OLE event occurs. ALL other events are ignored until the first is over. Markus suggest a timer class to circumvent the problem. I hope it's ok to reproduce here.
>>>
>>>DEFINE CLASS cCommandTimer AS timer
>>> Enabled=.F.
>>> Interval=1
>>> Name='cCommandTimer'
>>> cCommand=SPACE(0)
>>>
>>>PROCEDURE DoCommand
>>> LPARAMETERS lcCommand
>>> THIS.cCommand=lcCommand
>>> THIS.Enabled=.T.
>>> RETURN
>>>ENDPROC
>>>
>>>PROCEDURE Timer
>>> THIS.Enabled=.F.
>>> LOCAL lcCommand
>>> lcCommand=THIS.cCommand
>>> &lcCommand
>>> RETURN .T.
>>>ENDPROC
>>>ENDDEFINE
>>>
>>>The DO FORM is fired 'late' by the TIMER.DoCommand 'DO FORM
>>>This discusion in his tip article is more complete.
>>>Thanks Makus - I had just run into this puzzling problem:))))
>>>HTH
>>>
>>>
>>>>Look in Help/doc at AutoYield and DoEvents.
>>>>
>>>>Vlad
>>>>
>>>>>Did anyone already try to open a modal Form from a method within an OLE-Container containing an ActiveX-Control.
>>>>>
>>>>>I have such a constellation. A DO FORM command is issued from a method like CLICK or RIGHTCLICK. The method in question fires from within an ActiveX-Control like LISTVIEW or TREEVIEW. If the thus called Form is modal and that modal form itself contains an other ActiveX-Control like one of the upper ones, those ActiveX-Controls do not react on any event.
>>>>>
>>>>>Suggestions?
Previous
Reply
Map
View

Click here to load this message in the networking platform