Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing a form from a menu - newbie question
Message
From
21/09/2004 07:10:08
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00944466
Message ID:
00944472
Views:
16
>i have a menu option with two lines of code
>
>? wexist('gform') &&returns .t.
>gform.visible = .f. &&returns error "object gform is not found"
>
>not sure why that second line does not work if the form exists. how do i manipulate the form properties from within the menu? when i ran the form i am using "do form gform name gform"
>
>thanks,
>
>n.

Nancy,
2 parts.
1) wexist('gform') is not a verifier for gform is there as an object.

? wexist('gform') &&returns .t.
show window gform

2) If you use do form with name clause then be sure the 'name' is in scope later when it's called. It's like any other variable and has the same scoping rules.

public gForm
do form name gForm

would make it work BUT public variables are not suggested. Create a single custom object on your app on entry and save things that should persist there.

When you use that also change your code to:

if type('gForm.Visible')='L'
gForm.Visible = .f.
endif

PS: You might need extra checks if it's a form.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform