General information
Category:
ActiveX controls in VFP
Hi Todd,
I can't answer your question on how AutoYield really work, but I want to recall you that you will save a lot of time and frustration if you wrote the communication part in a COM using VB. I've tried using MSComm in VFP and got the same problem you got about OnComm() not firing reliably. I've used VFPCOM.BindEvents() has a patch, but the code is much more complex to read, it's harder to distribute and I'm not convinced about the reliability. I've created a COM in VB for another project using MSComm and had *no* problem with OnComm() that way.
>I've done some testing with the MSComm control and I'm not getting the results I expect. I put code inside the MSComm.OnComm event method to write code to a debugout.txt file:
>
>debugout 'OnComm fired'
>
>I set _VFP.AutoYield to .T. and put code in the click event of a command button to execute a long loop:
>
>debugout 'Click Start'
>nStartSeconds = seconds()
>for i = 1 to 20000
> txtSeconds.value = seconds() - nStartSeconds
> txtSeconds.refresh()
>endfor
>debugout 'Click End'
>
>When I clicked the command button I expected 'OnComm fired' to show up between 'Click Start' and 'Click End' but it didn't. I thought that with AutoYield set to .T. that VFP evaluated events after each line of code. Is this only true of Windows events such as click or does it hold for ActiveX events as well.
>
>When I put a 'doevents' inside the loop that executed every 100th cycle I got the same results. The 'doevents' didn't have any effect until I set AutoYield to .F. I then got the expected behavior.
>
>Does anyone know how events are really processed by VFP?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only