Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Modal forms
Message
De
28/08/2001 05:20:19
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
28/08/2001 04:45:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00549711
Message ID:
00549714
Vues:
27
>I want to return a value from a form which is instatiated modal form a class but it doesn't work because I get the returnvalue back of the show method :
>
>oMyForm=createobject("Myform")
>nReturnvalue=oMyform.show(1) && can't use .visible and .windowtype because it has to be modal
>
>I have an OK and Cancel button that release the form but I don't manage to alter the show's returnvalue. It seems that the value I get back is the one at 'SHOW' time, not at 'RELEASE' tiem.
>
>Any ideas ?

Pascal,
I wouldn't make it hard for myself using modal form's return value. Instead would pass a reference of caller to called form (modal or not). Called form then could access and set properties of caller. However as a workaround you could do it like this :

nRetVAlue = 0
oMyForm=createobject("Myform") && oMyForm could now access and set nRetValue
oMyform.show(1)
? nRetValue

This sample combines both approaches :
oCaller = createobject('CallerObject')
oMyForm=createobject("Myform",oCaller)
nReturnvalue=0
oMyform.show(1)
? nReturnValue, oCaller.RetValue


define class CallerObject as custom
	RetValue = .null.
enddefine
define class myForm as form
	oCaller = .null.
	procedure init
	lparameters toCaller
	this.oCaller = toCaller
	endproc
	procedure unload
	this.oCaller.RetValue = 'hello'
	nReturnValue = 8
	endproc
enddefine
Note that passing ref. approach let's you multiple values returned, and called form could call any event,method from caller.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform