Home > Archive > FoxPro Help and Support > January 2006 > A Form with visible = .F. at Design time comes up Visible!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author A Form with visible = .F. at Design time comes up Visible!
Jud

2006-01-28, 8:24 pm

Hi,
This is VFP6 SP5.

I've designed a Form WARNING in the Form Designer with Visible = .F.
In WARNING.INIT:
oWARNING = THISFORM

But when (in my code) I say:

DO FORM WARNING <------WARNING is immediately visible, but not set
up.

oWARNING.WIDTH = 179
oWARNING.MSG.CAPTION = "That Day is INVALID"
oWARNING.MSG.TOP = 19
oWARNING.MSG.HEIGHT = 22
oWARNING.MSG.LEFT = 13
oWARNING.MSG.WIDTH = 153
oWARNING.VISIBLE = .T. <----the correct WARNING pops on the screen.

For a moment, both copies of WARNING are on the screen at the same time
and then the first version (without the adjustments, in the wrong place
i. e. Top was set to 0 in the Form Designer) disappears, leaving the
correct one in the correct place.

Also, this code is in a VALID method of another Form and when I RETURN
..F. VFP pops a little gray window in the upper-right corner of the main
Form which says "Invalid Input". Since Form WARNING is there to do the
same thing I want to disable the little gray window but I can't figure
out how. Any suggestions?

Thanks for any help.
Jud

Stefan Wuebbe

2006-01-29, 3:23 am


"Jud" <judsonrp@fastmail.fm> schrieb im Newsbeitrag
news:1138485883.432017.90990@o13g2000cwo.googlegroups.com...
> Hi,
> This is VFP6 SP5.
>
> I've designed a Form WARNING in the Form Designer with Visible = .F.


In that regard, forms behave different than other native classes.
In your case the NoShow clause of the Do Form command might
work better - for example
Do Form xy NoShow
If (yourCondition)
xy.Show()
Endif


> In WARNING.INIT:
> oWARNING = THISFORM


(if oWarning is not a Local variable, you may or may not get a
"dangling reference" with that construction.)


> Also, this code is in a VALID method of another Form and when I RETURN
> .F. VFP pops a little gray window in the upper-right corner of the main
> Form which says "Invalid Input".


It is a textbox.Valid? Returning .F. there triggers that "native" error message -
you can Return 0 instead, to do your own Messagebox() or something.


hth
-Stefan



--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------

Olaf Doschke

2006-01-29, 8:24 pm

Hi Judi,

You may do like Stefan advised.

The way you work with the Reference oWarning
is much easier, if your form is a class. Because then
the form would also not show, if you set visible = .t.
in the class designer. Classes instanciated at runtime
allways remain invisible until you make them visible,
which is what you want. Also you don't need the
line oWarning = THISFORM in the init then.

You instead do:
oWarning = createobject("myWarningformclass")
....
oWarning.Show()
or
oWarning.Show(1)
if you want the program to halt, until the
user closes the form.

If you do
oWarning.Show()
and oWarning is a local var, this will destroy
the form imediately, as the var holding the
original object reference releases and so does
the object, so I'd recommend Show(1) here,
and define LOCAL oWarning before CreateObject().
Even better make it loWarning.

If you don't want the default message "invalid input"
from Valid (wehn returning .F.) you can set notify off
or return 0 instead, as Stefan said.

Bye, Olaf.


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com