Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Crash with combobox by popup
Message
De
27/12/2003 16:23:13
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Crash with combobox by popup
Divers
Thread ID:
00862276
Message ID:
00862276
Vues:
46
Hi,

Popup source for Combobox is very usefull,
but incorrect programming can destroy VFP memory coherence and fire a C05 error.
CREATE FORM ComboboxCrash nowait
IF ASELOBJ(aForm,1)>0
	WITH aForm[1]
  		IF .AddObject("cbtest","Combobox")
			WITH .cbtest
				.RowSourceType = 9
				.RowSource = "pp_st"
				TEXT TO m.code NOSHOW
					DEFINE POPUP pp_st RELATIVE
					DEFINE BAR 1 OF pp_st PROMPT "\<Barra 1"
				ENDTEXT
				.WriteMethod("Init",m.Code)
				.WriteMethod("DropDown","RELEASE POPUP pp_st")
			ENDWITH
		ENDIF
	ENDWITH
	KEYBOARD '{CTRL+W}' PLAIN CLEAR
	DO FORM ComboboxCrash
	WAIT WINDOW "Wait for crash - Not press please" TIMEOUT 3
	KEYBOARD '{ALT+DNARROW}' PLAIN CLEAR
ENDIF
Identical version on PRG not crash
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
WAIT WINDOW "Wait for crash - Not press please" TIMEOUT 3
KEYBOARD '{ALT+DNARROW}' PLAIN CLEAR
RETURN

DEFINE CLASS form1 AS form

	Caption = "Form1"
	Name = "FORM1"

	ADD OBJECT combo1 AS combobox WITH ;
		RowSourceType = 9, ;
		RowSource = "pp_st"

	PROCEDURE combo1.DropDown
		RELEASE  POPUP pp_st
	ENDPROC

	PROCEDURE combo1.Init && load
		DEFINE POPUP pp_st RELATIVE
		DEFINE BAR 1 OF pp_st PROMPT "\<Barra 1"
	ENDPROC

ENDDEFINE
But this is not true, this is for a very hugly VFP programming model:
Object instance on PRG and VCX/SCX are very very different

Run this, and the crash fire:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
WAIT WINDOW "Wait for crash - Not press please" TIMEOUT 3
KEYBOARD '{ALT+DNARROW}' PLAIN CLEAR
RETURN

DEFINE CLASS form1 AS form

	Caption = "Form1"
	Name = "FORM1"

	ADD OBJECT combo1 AS combobox WITH ;
		RowSourceType = 9, ;
		RowSource = "pp_st"

	PROCEDURE combo1.DropDown
		RELEASE  POPUP pp_st
	ENDPROC

	PROCEDURE load
		DEFINE POPUP pp_st RELATIVE
		DEFINE BAR 1 OF pp_st PROMPT "\<Barra 1"
	ENDPROC

ENDDEFINE
Fabio
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform