Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Code behind button built on the fly
Message
De
28/08/2003 19:45:27
 
 
À
26/08/2003 09:34:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00823387
Message ID:
00824421
Vues:
26
a quick example prg - hope this is what you were looking for:

jtest=CREA('joe_form')
jtest.ADDOBJECT('joe_click','joe_click')
jtest.SHOW()


WAIT WINDOW jtest.CAPTION
*-- kill it
jtest=.NULL.


DEFINE CLASS joe_form AS FORM
*-- modal form
WINDOWTYPE=1
CAPTION='Test'
ENDDEFINE

DEFINE CLASS joe_click AS COMMANDBUTTON
HEIGHT=20
WIDTH=85
TOP=1
LEFT=1
VISIBLE=.T.
CAPTION='Close Form'

PROCEDURE CLICK
THISFORM.CAPTION='My new Caption'
WAIT WINDOW 'test...'
*-- if you want to keep the object alive, just set visible to .f.
*-- you must want to get some data with the form etc... put in properties
*-- then kill the object by setting it to .null. in the calling prg.
THISFORM.VISIBLE=.F.

ENDPROC
ENDDEFINE









>I have a simple form I am building "on the fly". When the user presses a button on another form, this form is built and displayed. I have an edit box and a button on the form. I just can't seem to figure out how to put the code behind the button to close the form. Here is the code I am using to build the form (located in the Click event of the button the user presses to display the form):
> frmErrorText = CREATEOBJECT('frmbase')
> WITH frmErrorText
> .AUTOCENTER = .T.
> .closable = .T.
> .controlbox = .T.
> .height = 350
> .width = 450
>
> .ADDOBJECT('edtErrText', 'editbase')
> .ADDOBJECT('cmdClose', 'cmd')
>
> WITH .edtErrText
> .LEFT = 5
> .TOP = 5
> .WIDTH = 300
> .HEIGHT = 300
> .VALUE = FILETOSTR('errors.txt')
> .VISIBLE = .T.
> ENDWITH
>
> .cmdClose.CAPTION = 'Close'
> .cmdClose.LEFT = 325
> .cmdClose.TOP = 325
> .cmdClose.HEIGHT = 25
> .cmdClose.VISIBLE = .T.
>
> .SHOW
> ENDWITH
>
>Any ideas would be greatly appreciated.
>
>Thanks!
Thanks,

Stacy



Black Mountain Software, Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform