lun. 03 septembre 2018, 09h43
Jean-Claude Rivi=c3=a8re
atoutfox.public.association
Re: petit souci
Salut Eddy,
C'est normal, puisqu'elle est releasée.
Tu peux mettre ta variable en privée ou locale, et laisser ton
formulaire en modal. Remplace simplement les 3 thisform.release, par
thisform.hide(). Le code va alors continuer lors du clic sur les boutons
et ta variable lo sera remplie. Il faut quand même la tester pour le cas
d'appui sur la croix de fermeture, dans ce cas, il me semble qu'elle
vaut null.
Cdlt,
JC
Le 03/09/2018 à 02:13, eddymaue a écrit :
> bonsoir
>
> Public lo
>
> lo = Createobject("EMImputBox","Exemple : MaVariable = 5","Local as
> string",6)
> lo.show()
>
> Set Step On
> lcRetValue = lo.cRetValue
>
> la varible lo n'existe plus au retour du formulaire modal pourtant elle
> est publique
>
> une idée
>
> a+ eddy
>
>
> voilà le code
>
> Public lo
>
> lo = Createobject("EMImputBox","Exemple : MaVariable = 5","Local as
> string",6)
> lo.show()
>
> Set Step On
> lcRetValue = lo.cRetValue
>
>
> *If Not Empty(lo.cRetValue)
>
>
> **************************************************
> *-- Auteur : Eddy Maue
> *-- Form: form1 (c:\vfp\dev\test_emimputbox.scx)
> *-- ParentClass: form
> *-- BaseClass: form
> *-- Time Stamp: 09/02/18 06:36:02 PM
> *
>
> Define Class EMImputBox As Form
>
> AutoCenter= .T.
> WindowType= 1 && modal
> Top = -1
> Left = 0
> Height = 108
> Width = 289
> DoCreate = .T.
> Caption = "EmImputBox : cDialogCaption"
> *-- XML Metadata for customizable properties
> * _memberdata = [<VFPData><memberdata name="autosize"
> type="property" favorites="True"/><memberdata name="ctitre"
> display="cTitre"/><memberdata name="ccaption"
> display="cCaption"/><memberdata name="ccaption_assign"
> display="cCaption_Assign"/><memberdata name="ctitre_assign"
> display="cTitre_Assign"/><memberdata name="cretvalue"
> display="cRetValue"/><memberdata name="mannuler"
> display="mAnnuler"/><memberdata name="maccept"
> display="mAccept"/></VFPData>]
> cTitre = ""
> cCaption = ""
> cRetvalue = ""
> Name = "Form1"
>
>
> Add Object lblPromptInput As Label With ;
> AutoSize = .T., ;
> Caption = "cInputPrompt ", ;
> Height = 17, ;
> Left = 5, ;
> Top = 12, ;
> Width = 78, ;
> Name = "lblPromptInput "
>
>
> Add Object btnAccept As CommandButton With ;
> Top = 72, ;
> Left = 107, ;
> Height = 27, ;
> Width = 84, ;
> Anchor = 12, ;
> Caption = "Accepter", ;
> Default = .T., ;
> Name = "btnAccept"
>
>
> Add Object btnAnnuler As CommandButton With ;
> Top = 72, ;
> Left = 197, ;
> Height = 27, ;
> Width = 84, ;
> Anchor = 12, ;
> Cancel = .T., ;
> Caption = "Annuler", ;
> Name = "btnAnnuler"
>
>
> Add Object edit1 As EditBox With ;
> Anchor = 15, ;
> Height = 24, ;
> Left = 5, ;
> ScrollBars = 0, ;
> Top = 36, ;
> Width = 276, ;
> Name = "Edit1"
>
>
> Procedure ccaption_assign
> Lparameters tcCaption
>
> Store m.tcCaption To This.cCaption, This.Caption
> Endproc
>
>
> Procedure ctitre_assign
> Lparameters tcTitre
> This.cTitre = tcTitre
> This.label1.Caption = tcTitre
> Endproc
>
>
> Procedure mAccept
> Thisform.cRetvalue = Thisform.edit1.Text
> Thisform.Release()
> Endproc
>
>
> Procedure Unload
> Return This.cRetvalue
> Endproc
>
>
> Procedure Init
> Lparameters tcTitre,tcCaption, tcDefaultValue
>
> Local lsDefault As string
> lsDefault = Transform(m.tcDefaultValue)
>
> If Vartype(m.tcCaption)=="C" And Not Empty(m.tcCaption)
> This.Caption = m.tcCaption
> Endif
>
> If Vartype(m.tcTitre)=="C" And Not Empty(m.tcTitre)
> This.lblPromptInput.Caption = m.tcTitre
> Endif
>
> If Vartype(m.lsDefault)=="C" And Not Empty(m.lsDefault)
> This.edit1.Value = Transform(m.lsDefault)
> Endif
> Endproc
>
>
> Procedure mAnnuler()
>
> thisform.Release()
>
> Endproc
>
>
> Procedure btnAccept.Click
> Thisform.mAccept()
> Endproc
>
>
> Procedure btnAnnuler.Click()
> Thisform.cRetvalue = ""
> Thisform.Release()
> Endproc
>
>
> Enddefine
> *
> *-- EndDefine: form1
> **************************************************
>
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000019179