Subject Re: Form requires forced input
From Andy Taylor <andy.taylor@which.net>
Date Wed, 09 Aug 2017 04:42:24 -0400
Newsgroups dbase.getting-started

Hi Michael,

I see the (small) difference between f.open() and f.readmodal() in that readmodal adds a very slight bevelled border to the form window.
Actually I prefer it to the way that f.open looks. Clearly, however, you don't.

Although you might argue that there should not be a difference it may be something that dBASE has no control over - the window
you are opening is specifically outside the dBase mdi worktop and that may be something enforced by windows?
If you feel that strongly then submit a bug report, but don't hold your breath as this is a cosmetic problem only. There is no issue with
readmodal working as advertised - it holds focus on the form without any coding on your part.

To get around the focus loss using f.open you could add this to the form constructor code.
      onLostFocus = {;this.setfocus()}
You can still shift focus off the form but it comes back immediately.

Regards,
Andy
PS: sysMenu = false to remove the border and close button (Of course! Nice one).

> Hi Andy,
>
> Yes I did, cute.
>
> Ok, so I am calling the form from another program. So i am using your testform as an example and you will see how the window size reacts but the main problem is using the open then the focus can be shifted off the window.
>
> Here is a simple call program. Use this to see the different effect between f.open() and f.readmodal(). You will see what I mean.
>
> * file testpop.prg *
>
> set procedure to testform.wfm ADDITIVE
>                                 
> f = NEW modalform()
> f.mdi = .f.
> F.SYSMENU = .f.
> f.open()            && change this to f.readmodal() to see the difference
>
> * end testpop.prg
>
> A slight modification to your test form:
>
> *--Modal.wfm starts here--*
> ** END HEADER -- do not remove this line
> //
> // Generated on 09/08/2017
> //
> parameter bModal
> local f
> f = new ModalForm()
> if (bModal)
>    f.mdi = false // ensure not MDI
>    f.readModal()
> else
>    f.open()
> endif
>
> class ModalForm of FORM
>    with (this)
>       canClose = class::CANCLOSE
>       onOpen = class::ONOPEN
>       height = 11.9545
>       left = 91.0
>       top = 11.1818
>       width = 39.5714
>       text = "You will obey me"
>       topMost = true
>       mdi = false
>       showTaskBarButton = false
>       smallTitle = true
>       sizeable = false
>       moveable = false
>       escExit = false
>       maximize = false
>       minimize = false
>    endwith
>
>    this.PUSHBUTTON1 = new PUSHBUTTON(this)
>    with (this.PUSHBUTTON1)
>       onClick = {;this.text = "Thankyou. You may proceed"; form.jobDone=true}
>       height = 1.0909
>       left = 1.8571
>       top = 8.5455
>       width = 35.5714
>       text = "I apologise"
>    endwith
>
>    this.PUSHBUTTON2 = new PUSHBUTTON(this)
>    with (this.PUSHBUTTON2)
>       onClick = {;form.close()}
>       height = 1.0909
>       left = 11.0
>       top = 10.0909
>       width = 15.2857
>       text = "Close"
>    endwith
>
>    this.TEXT1 = new TEXT(this)
>    with (this.TEXT1)
>       height = 7.2727
>       left = 1.7143
>       top = 0.5455
>       width = 35.8571
>       colorNormal = "DarkRed/White"
>       marginHorizontal = 2.0
>       marginVertical = 2.0
>       text = "Admit your error: Push the button!"
>       borderStyle = 1        // Raised
>    endwith
>
>
>         function onOpen
>                 form.jobDone = false        // mark job as not done
>
>         function canClose
>                 return form.jobDone
>
> endclass
>
> *--Modal.wfm ends here--*