jeu. 13 mars 2014, 14h39
eddymaue
atoutfox.public.association
Re: j'ai oublie comment sortir d'un formulaire avec Show(1)
bon j'ai trouvé
il faut écrire
goForm.show(1)
et non
with goForm
.show(1)
endwith
eddymaue a formulé ce jeudi :
> Bonjour et merci d'avance
>
> #define D_AUTEUR "Eddy Maue"
>
> local ;
> cClassName as character, ;
> cBaseClass as character, ;
> cAuteur as character ,;
> nSpace as integer
>
> private g_oCustom,goForm
>
> m.g_oCustom = createobject("custom")
>
> m.g_oCustom.addproperty("cClassName")
> m.g_oCustom.addproperty("cBaseClass")
> m.g_oCustom.addproperty("cAuteur")
> m.g_oCustom.addproperty("success")
>
> m.goForm = createobject("Form1",m.g_oCustom)
>
> with m.goForm as form
> .show(1)
> endwith
>
> if vartype( m.g_oCustom.cClassName)="C" and m.g_oCustom.succes
>
> m.cClassName = m.g_oCustom.cClassName
> m.cBaseClass = m.g_oCustom.cBaseClass
> m.cAuteur = m.g_oCustom.cAuteur
>
> else
> return
> endif
>
> nSpace = 20
> set talk off
> set talk off
> set textmerge to
> set textmerge off
>
> set textmerge on noshow && Enable text merge, no output to screen
> set textmerge delimiters to && Default text merge delimiters <<,>>
> set textmerge to memvar myvar && Create and send output to date.txt
>
> *TEXT TO myvar TEXTMERGE NOSHOW
> * ******************************************************
> * * Auteur<<space(nSpace-len("Auteur"))>>:<<allt(cAuteur)>>
> * * -----------------------------
> * * Classe Nom<<space(nSpace-len("Classe Nom"))>>:<<allt(cClassName)>>
> * * Classe Parent<<space(nSpace-len("Classe Parent"))>>:<<allt(cBaseClass)>>
> * * -----------------------------
> * * Créé le<<space(nSpace-len("Créé le"))>>:<<TRANSFORM(DTOS(DATE()),"@R
> 9999-99-99")>>
> * * Modifier le<<space(nSpace-len("Modifier le"))>>:
> * ******************************************************
> \ DEFINE CLASS << cClassName >> AS << cBaseClass >>
>
> do case
> case lower(cBaseClass) = "grid"
> \
> \ width = 300
> \ height = 300 * 5 / 9
> \ top = 10
> \ left = 10
> \
> \ RecordSource = ""
> \ RecordSourceType = "" && 1-Alias,2-Prompt,3-query,4-sqlStatement
> \ ColumnCount = 4 && nField
> \
> \ Procedure GridHitTest && of << cClassName >>
> \ Lparameters nXCoord_In, nYCoord_In && [, nWhere_Out [, nRelRow_Out
> [, nRelCol_Out [, nView_Out]]]])
> \
> \ ENDPROC && GridHitTest of << cClassName >>
>
> otherwise
>
> endcase
>
> \ PROCEDURE Init && of << cClassName >>
> \ ~
> \ ENDPROC && << cClassName >> :: Init
> \
> \ PROCEDURE Destroy && of << cClassName >>
> \
> \ ENDPROC && << cClassName >> :: Destroy
> \
> \ PROCEDURE Error(nError, cMethod, nLine) && of << cClassName >>
> \
> \ ENDPROC && Error of << cClassName >>
> \
> \ ENDDEFINE
>
> set textmerge to
>
> return myvar
>
> define class form1 as form
>
> p_oData = .f.
>
> procedure init
> lparameters tObject
>
> with this as thisform
> .p_oData = m.tObject
>
> *!* cClassName = allt( inputbox(" Nom de la classe " , "
> Define class ","NomDeLaClasse") )
> *!* cBaseClass = allt( inputbox(" Nom de la Classe parent ", "
> Define class ","Custom") )
> *!* cAuteur = allt( inputbox("Auteur" ," Define Class ","Eddy
> Maue") )
>
> .addobject("lblClassName","Clsslbl" , "Nom de la classe")
>
> store 10 to .lblClassName.top , .lblClassName.left
>
> .addobject("txtClassName","ClssTxt")
> .TxtClassName.m_Positionne(.TxtClassName,.lblClassName)
>
> .addobject("lblBaseClass","Clsslbl","Nom de la Classe parent")
> .lblBaseClass.m_Positionne(.lblBaseClass,.TxtClassName)
>
> .addobject("txtBaseClass","ClssTxt")
> .txtBaseClass.m_Positionne(.txtBaseClass,.lblBaseClass)
>
> .addobject("lblAuteur","Clsslbl","Auteur")
> .lblAuteur.m_Positionne(.lblAuteur,.txtBaseClass)
>
> .addobject("txtAuteur","ClssTxt")
> .txtAuteur.m_Positionne(.txtAuteur,.lblAuteur)
> .txtAuteur.value = D_AUTEUR
>
> .addobject("btnAccept","ClssBtn")
>
>
> .btnAccept.m_Positionne(.btnAccept,.txtAuteur,abs(.txtAuteur.left+
> .txtAuteur.width-.btnAccept.width))
> with .btnAccept as commandbutton
> .caption = "Accepter"
> .default=.t.
> endwith
>
> .addobject("btnCancel","ClssBtn")
>
> .btnCancel.m_Positionne(.btnCancel,.txtAuteur)
> with .btnCancel as commandbutton
> .caption = "Annuler"
> .cancel=.t.
> endwith
>
> .addobject("BtnReset","ClssBtn")
>
> .BtnReset.m_Positionne(.BtnReset ,.txtAuteur ,abs(.btnCancel.left
> + .btnCancel.width+10))
> with .BtnReset as commandbutton
> .caption = "Effacer"
> .cancel=.t.
> endwith
>
> .width = .txtAuteur.left+.txtAuteur.width + 10
>
> endwith
>
> enddefine
>
> define class clsslbl as label
> visible = .t.
>
> procedure init
> lparameters lcCaption
>
> if vartype(m.lcCaption)="C"
>
> this.caption = m.lcCaption
>
> endif
>
> procedure m_Positionne (lothis, lo , left , top)
>
> local loClssPos as custom
> m.loClssPos = createobject("ClssPos" ,lothis ,lo , left , top)
>
> endproc
>
> enddefine
>
> define class clssTxt as textbox
> visible = .t.
> width = 300
>
> procedure m_Positionne (lothis ,lo , left , top)
>
> local loClssPos as custom
> m.loClssPos = createobject("ClssPos",lothis ,lo , left , top)
>
> endproc
>
> enddefine
>
> define class ClssBtn as commandbutton
> visible = .t.
>
> p_lCancel = .f.
> p_lAccept = .f.
>
> autosize = .t.
>
> *
> /¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
> Init
> * / Eddy Maue a+ -- Créer le : 2014-03-13
> procedure init
>
> do case
> case "btnaccept" = this.name
> this.p_Accept = .t.
>
> case "btncancel" = this.name
> this.p_lCancel = .t.
>
> otherwise
>
> endcase
>
> endproc && Init
>
> procedure m_Positionne (lothis ,lo , left , top)
>
> local loClssPos as custom
> m.loClssPos = createobject("ClssPos",lothis ,lo , left , top)
>
> endproc
>
> *
> /¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
> click
> * / Eddy Maue a+ -- Créer le : 2014-03-13
> procedure click
>
> with thisform
>
> do case
> case this.caption = "Accept"
>
> thisform.p_oData.success = .t.
>
> set step on
>
> Release m.goForm
> thisform.release()
>
> case this.caption = "Effacer"
>
> .TxtClassName.value = ""
> .txtBaseClass.value = ""
> .txtAuteur.value = D_AUTEUR
>
> case this.caption = "Annuler"
>
> Release m.goForm
> thisform.release()
>
> otherwise
>
> endcase
>
> endwith
>
> endproc && click
>
> *
> /¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
> release
> * / Eddy Maue a+ -- Créer le : 2014-03-13
> PROCEDURE release
>
> Release m.goForm
>
> Endproc && release
>
> enddefine
>
> define class ClssPos as custom
>
> procedure init (lothis, lo , left , top)
>
> lothis.left = iif(empty(m.left) ,lo.left ,m.left)
> lothis.top = iif(empty(m.top) ,lo.top+lo.height+10 ,m.top)
>
> endproc
>
> enddefine
--
Merci de partager avec moi votre immense savoir que je me ferai plaisir
d'absorber...
il va de soi que je vais vous en laisser un peu
Politesse et savoir vivre oblige ;0)
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000014185