Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Code after Pageframe Activate is complete? 2

Status
Not open for further replies.

David Higgs

Programmer
May 6, 2012
392
GB
In my application I have a Pageframe that contains a grid. In the Activate of the 'Page' I have some code that runs a 'check up' routine. Whilst this code is executing the 'Page' is waiting for the code to complete before it shows the form in full. You can still see parts of the previous screen whilst the 'check up' routine is running and the Grid being updated.

What I would like to do is show the form in full and then run the code for the 'check up' routine. I don't mind seeing the completed form whilst the Grid is being updated (quite expect it), but not the form being slowly created whilst the Grid is being updated . How would achieve this?

The 'check up' routine changes the 'Back Color' of the Grid's individual Cells dependent on contents in another cursor.


Regards,

David.

Recreational Developer / End User of VFP.
 
A simple solution would be to move the code from the Activate Event of the Page to the GotFocus event of the first page control in tab order.

That would have a strange dependency of the page with its first control, but you may use an extra button you move off the visible page area (give it a negative top/left larger than width/height), set it to have tabindex 1. Then activate finishes and the next event will be This controls When event, but that's still too early, I think.

You may also look into UIEnable/UIDisable events of all page controls. That'll mean a lot of work to let all UIDisable make the controls invisible and all UIEnable to make controls visible, but give it a try for just one or two controls of the previous and the page in question. It will only solve the problem of previous page controls being visible while the current page is still in Activate event, so when you want that to be instant the only viable solution is makinng use of such an extra control and VFPs event chain.

You could also use a timer to have the code about the backcolors. A timer which you disable at design time, enable at Page.Activate and which disables itself in the Timer even. The effect is that the tier starts after say 10 ms when the Activate already is through. You still have an extra control on the page, though - the timer. This solution just can be used in more situations, if you make that a timer class and subclass timers with different Timer events for the cases you use them or make the code it executes a dynamic parameter of the timer class init.

And then there is BindeEvents and its parameter controlling whether the object event itself runs first or last, That's needing another class to drag to the page and bind the Activate event to one of its methods.

Chriss
 
Chris Miller said:
You could also use a timer to have the code about the backcolors. A timer which you disable at design time, enable at Page.Activate and which disables itself in the Timer even. The effect is that the tier starts after say 10 ms when the Activate already is through.

I quite like that idea, I will give it a try.

Regards,

David.

Recreational Developer / End User of VFP.
 
Chris Miller said:
You could also use a timer to have the code about the backcolors. A timer which you disable at design time, enable at Page.Activate and which disables itself in the Timer even. The effect is that the tier starts after say 10 ms when the Activate already is through.

Well, that worked a treat, thank you very much.

Regards,

David.

Recreational Developer / End User of VFP.
 
Mike Yearwood said:
The LockScreen property is really used for this.

Many thanks Mike, I will try that. It's all part of the learning curve to try the various options available.

P.S

The 'Lock Screen' gives the required effect; such that I will use it on the other 'Page Activate' routines where I also notice a (slightly) slow transition.

Thanks again for your suggestion.

Regards,

David.

Recreational Developer / End User of VFP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top