Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C0000005 in Treeview keypress
Message
From
18/04/2002 12:13:16
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00633579
Message ID:
00646421
Views:
19
>VFP 7 / WindowsXP / VFP7 / Form with a MS Treeview Control 6.0(SP4).
>
>The Cancel property of the form's Exit button is set to .T.
>
>I'd like to exit the form when the user presses ESC while the Treeview has the focus (which is most of the time, I use it as a pick list)
>
>I have this code in the keypress method of the Treeview:
>
>*** ActiveX Control Event ***
>LPARAMETERS keyascii
>
>if keyascii = 27
>   thisform.cmdexitg1.Click()
>   nodefault
>*  thisform.KeyPress(keyascii)  && tried this too, but ii does nothing...
>else
>   dodefault()
>endif
>
>It works, it presses the Exit button, the form exits, and then I get C0000005. Any ideas what's wrong?
>
>TIA

Hi Doru,

I cannot reproduce the c0000005 fatal exception using your code in a simple form. Can you provide me with additional info so I can have a look at this?

Here is the code I used for testing:
PUBLIC oform1
oform1=NEWOBJECT("form1xxx")
oform1.Show
RETURN

DEFINE CLASS form1xxx AS form
	Caption = "Form1"
	Name = "Form1"
	
	ADD OBJECT olecontrol1 AS olecontrol WITH ;
		Top = 36, ;
		Left = 48, ;
		Height = 169, ;
		Width = 205, ;
		Name = "Olecontrol1",;
		oleclass = 'MSComctlLib.TreeCtrl.2'

	ADD OBJECT cmdExit AS commandbutton WITH ;
		Top = 215, ;
		Left = 48, ;
		Cancel = .t., ;
		Height = 25, ;
		Width = 50, ;
		Name = "cmdExit", ; 
		caption = 'Close'

	PROCEDURE olecontrol1.init
		WITH this.object
			.Nodes.Add(,,,'One')
			.Nodes.Add(,,,'Two')
			.Nodes.Add(,,,'Three')
		ENDWITH 
	ENDPROC 
	
	
	PROCEDURE olecontrol1.keypress
	LPARAMETERS keyascii
		if keyascii = 27
		   thisform.cmdexit.Click()
		   nodefault
		*  thisform.KeyPress(keyascii)  && tried this too, but ii does nothing...
		else
	   		dodefault()
		endif
	ENDPROC

	PROCEDURE cmdExit.Click
		thisform.Release
	ENDPROC 
ENDDEFINE
Thanks!
Jim Saunders
Microsoft
This posting is provided “AS IS”, with no warranties, and confers no rights.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform