Hi all,
I'm new in programming Visual FoxPro, and am using version 8.
At the moment I'm encountering the following problem which I can't solve,
I have a top-level form that has one command button named btnMaintain to open another form
using createobject function. When I clicked on that button, that second form showed
up very quickly before it disappeared. It is supposed to display a modeless form.
Has anyone ever encountered the same problem and know how to fix it ?
The codes are listed below.
Thanks for all your help.
* main.prg
IF !FILE('frmTest3.scx')
cCurrentProcedure = SYS(16,1)
nPathStart = AT(":",cCurrentProcedure)- 1
nLenOfPath = RAT("\", cCurrentProcedure) - (nPathStart)
SET DEFAULT TO (SUBSTR(cCurrentProcedure, nPathStart, nLenofPath))
ENDIF
DO FORM frmTest3
READ EVENTS
*------------------------------------------------------------
* testprg1.prg
DEFINE CLASS frmSearch As Form
Caption = 'Search Form'
Left = 2
Top = 2
Width = 100
Height = 100
AutoCenter = .T.
ENDDEFINE
DEFINE CLASS frmSearchChild As frmSearch
Visible = .T.
ADD object txtAddress as Textbox
PROCEDURE Destroy
CLEAR events
ENDPROC
ENDDEFINE
*------------------------------------------------
*Inside frmTest3.scx
procedure Init
Application.Visible = .F.
endproc
procedure Destroy
Application.Visible = .T.
CLEAR EVENTS
thisForm.Release
RELEASE all
endproc
* Inside btnMaintain
procedure Click
SET PROCEDURE TO TestPrg1.prg additive
frmMaintain = CREATEOBJECT("frmSearchChild")
IF TYPE("frmMaintain") = "O" AND !ISNULL(frmMaintain)
frmMaintain.Caption = 'Maintenance'
frmMaintain.Show(2) && modeless
ENDIF
endproc
Note:
If I changed the parameter of Show from 2 to 1 (modal) then the form is displayed properly.
I'm new in programming Visual FoxPro, and am using version 8.
At the moment I'm encountering the following problem which I can't solve,
I have a top-level form that has one command button named btnMaintain to open another form
using createobject function. When I clicked on that button, that second form showed
up very quickly before it disappeared. It is supposed to display a modeless form.
Has anyone ever encountered the same problem and know how to fix it ?
The codes are listed below.
Thanks for all your help.
* main.prg
IF !FILE('frmTest3.scx')
cCurrentProcedure = SYS(16,1)
nPathStart = AT(":",cCurrentProcedure)- 1
nLenOfPath = RAT("\", cCurrentProcedure) - (nPathStart)
SET DEFAULT TO (SUBSTR(cCurrentProcedure, nPathStart, nLenofPath))
ENDIF
DO FORM frmTest3
READ EVENTS
*------------------------------------------------------------
* testprg1.prg
DEFINE CLASS frmSearch As Form
Caption = 'Search Form'
Left = 2
Top = 2
Width = 100
Height = 100
AutoCenter = .T.
ENDDEFINE
DEFINE CLASS frmSearchChild As frmSearch
Visible = .T.
ADD object txtAddress as Textbox
PROCEDURE Destroy
CLEAR events
ENDPROC
ENDDEFINE
*------------------------------------------------
*Inside frmTest3.scx
procedure Init
Application.Visible = .F.
endproc
procedure Destroy
Application.Visible = .T.
CLEAR EVENTS
thisForm.Release
RELEASE all
endproc
* Inside btnMaintain
procedure Click
SET PROCEDURE TO TestPrg1.prg additive
frmMaintain = CREATEOBJECT("frmSearchChild")
IF TYPE("frmMaintain") = "O" AND !ISNULL(frmMaintain)
frmMaintain.Caption = 'Maintenance'
frmMaintain.Show(2) && modeless
ENDIF
endproc
Note:
If I changed the parameter of Show from 2 to 1 (modal) then the form is displayed properly.