Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Escaping a treeview control.
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01128705
Message ID:
01128827
Views:
24
Hi Sergey,

Our forms all have a common routine called _DoCmd. When Esc is pressed, the cancel button is clicked or when the QueryUnload event fires, they all call _DoCmd with 'ESC'.

_DoCmd has the following code:
LPARAMETERS cCommand

...

case cCommand == 'ESC'
    if p_confirm([Are you sure you want to abandon changes?])
        thisform.release
    endif
...
I can't explain how your solution works. Somehow, _DoCmd gets called with "ESC". Does Release call QueryUnload? If so, how does the above code run without becoming an endless loop when called from QueryUnload?

I had tried the following from the treeview control:
*Treeview Keypress
LPARAMETERS keyascii

if keyascii = 27
   thisform._DoCmd('ESC')
endif 
The problem was, the confirm box popped up twice when I ran my code that way while your code worked. Can you help me understand what is happening here?

Thanks so much for your help.

Rodd

>Try
>* Treeview Keypress
>*** ActiveX Control Event ***
>LPARAMETERS keyascii
>IF keyascii = 27
>	Thisform.Release()
>ENDIF	
>
>>In our system, the escape key exits you out of a form back to the calling form. I just created a new form in which I use the MS treeview control. When the control has the focus and the user presses Esc, I just get an annoying beep. Apparently the form is never notified that the Esc key was pressed.
>>
>>I've tried trapping the Esc keypress through the treeviews keypress event but with not much success. I can trap it enough to force focus onto a different control so that the user can then press escape, but I can't seem to make the Esc keypress work the same as it would from any other control. (Basically, the form's keypress generally handles the Escape keypress and calls a routine to shut down the form.)
>>
>>Is there any way to make the treeview stop beeping on the Esc keypress?
>>
>>Thanks so much for your help.
>>
>>Rodd
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform