Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Page.Activate and uiEnable
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00847372
Message ID:
00848497
Views:
14
Hi Bill,

PMFJI -- but could you approach it like this:
1) disable all but the first page
2) put the login test code in the Deactivate() of Page1, and
3) set the Enabled property of the pages only if the test passes

This should allow you to show the messagebox and/or re-focus back to the desired page, regardless of which one it is.

UPDATE: Another thought after I sent this -- create a custom method of the PageFrame called CommonPageActivate() or something similar. Call this from *each* page of the PageFrame by default (maybe in your Page subclass?). In *that* method, test for your login requirements and set the desired focus/enable the desired stuff/you get the idea. This way, you only have to have your code in one place for ALL the pages in the PageFrame, regardless of how many you might add or remove in a later modification.


>Hi Will,
>I'm trying to prevent access to certain pages until the user has logged into a web-site. Page1 has the Log In controls. So if the user clicks on the Page3 tab, I want a messagebox to tell them that they can't get onto that page until they have Logged In, and then put the focus on Page1 where they can Log In.
>
>I tried setting page3.enabled=.F., but then I can't put the messagebox up. Page3.Activate() seems like the most logical place to put it.
>
>
>
>>Bill,
>>
>>What are you trying to do? The page activate event and uienable event fire far too often for placing code in.
>>
>>There are only certain times you should need to enable a control on a page:
>>
>>The user clicked on a page tab to TURN a page
>>
>>or
>>
>>The cursor is sitting on a page tab and the user hits the arrow left or right key or the page down or page up key.
>>
>>These are the only times when a user is actually TURNING a page.
>>
>>>I'm using VFP 7.0
>>>
>>>Is there any difference between these 2 code samples?
>>>
>>>......Page3.Activate()
>>>  This.myControl.Enabled = Thisform.SomeProperty
>>>
>>>
>>>......Page3.myControl.UIEnable
>>>LPARAMETERS lEnable
>>>if lEnable
>>>  this.Enabled = Thisform.SomeProperty
>>>endif
>>>
Evan Pauley, MCP
Positronic Technology Systems LLC
Knoxville, TN

If a vegetarian eats vegetables, what does a humanitarian eat?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform