Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closing a modal form
Message
 
 
To
27/05/2023 14:09:39
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01686646
Message ID:
01686678
Views:
22
>>Thank you, Lutz.
>>I am thinking of going back to the modal popup form. The only thing that it would not have - unless I implement event method that you suggested - is ability to close the form when a user clicks outside the form. Other than that everything will work.
>>I suspect that to make the MODELESS form pass a value to the calling procedure and then calling procedure being "in control" after the popup form is hidden, will take too many jumps through the hoop.
>
>It's rather simple, two forms, one calling the other and return value on deactivate the second, then the first closes the second.
>
>PUBLIC poMyForm
>poMyForm = CREATEOBJECT("myform")
>poMyForm.VISIBLE = .T.
>
>DEFINE CLASS myform2 AS FORM
> AUTOCENTER = .T.
> ALLOWOUTPUT = .F.
> goParent = .NULL.
>
> PROCEDURE ACTIVATE
>  ?this.Caption+' activated'
> ENDPROC
>
> PROCEDURE DEACTIVATE
>  ?this.Caption+' deactivated'
>  THIS.goParent.GET_RESULT('Value sent')
> ENDPROC
>
> PROCEDURE INIT
>  LPARAMETERS;
>   toParent
>
>  THIS.goParent = toParent
> ENDPROC
>ENDDEFINE
>
>DEFINE CLASS myform AS FORM
>
>
> DOCREATE = .T.
> CAPTION = "Form"
> NAME = "myform"
> LEFT = 100
> oform = .NULL.
> ALLOWOUTPUT = .F.
>
>
> ADD OBJECT command1 AS COMMANDBUTTON WITH ;
>  TOP = 18, ;
>  LEFT = 29, ;
>  HEIGHT = 34, ;
>  WIDTH = 87, ;
>  CAPTION = "Start Form", ;
>  NAME = "Command1"
>
>
> ADD OBJECT label1 AS LABEL WITH ;
>  CAPTION = "Start form", ;
>  HEIGHT = 27, ;
>  LEFT = 40, ;
>  TOP = 104, ;
>  WIDTH = 90, ;
>  NAME = "Label1"
>
>
> PROCEDURE GET_RESULT
>  LPARAMETERS;
>   tcResult
>
>  THIS.label1.CAPTION = tcResult
>   THISFORM.oform = .NULL.
>
> ENDPROC
>
>
> PROCEDURE command1.CLICK
>  IF ISNULL(THISFORM.oform) THEN
>   THISFORM.oform = CREATEOBJECT("myform2",THISFORM)
>   THISFORM.oform.VISIBLE = .T.
>   THISFORM.label1.CAPTION = "wait for result"
>
>  ENDIF &&ISNULL(THISFORM.oform)
> ENDPROC
>
> PROCEDURE ACTIVATE
>  ?this.Caption+' activated'
> ENDPROC
>
> PROCEDURE DEACTIVATE
>  ?this.Caption+' deactivated'
> ENDPROC
>
> PROCEDURE QUERYUNLOAD
>  THIS.oform = .NULL.
> ENDPROC
>
>ENDDEFINE
>
Thank you, Lutz. I will review this and try it.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform