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!

Refreshing bound controls

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
GB
There is a form which is used for maintaining (Creating and editing) records in a table. There are several bound controls on the form. When the form moves to a new record the bound controls show the values from the new record.

When the form moves to a new record, there is an instruction Thisform.refresh(). This works fine if the controls are placed directly on the form.

But if there are two pages on the form (because there are a lot of fields in the table), only the controls on the currently visible page are refreshed - and if you click to view the other page, you see the values from the previous record.

To get round this, after moving to a new record, I am issuing these instructions.

Code:
Thisform.refresh()
Thisform.<PageFrame>.Page1.refresh()
Thisform.<PageFrame>.Page2.refresh()

Is this the correct approach, or are there better ways to do this?

Thanks. Andrew
 
With just a few pages, why not?

You can make it a very general approach of doing a refresh within a page.activate event.

Bye, Olaf.
 
Andrew,
My philosophy overall is use "REFRESH" methods as limited as possible. Some events will cause a refresh. The default refresh is to update data, but it is also sometimes used to change state (like enabled/disable, visible/not visible, etc). But this can cause "flashing" in your screen. To avoid that a call to "ThisForm.Locscreen = .T." will keep the state of the screen, buand then a "Thisform.LockScreen = .F." will make it active again. There are 2 caveats to consider in that case. 1) If you have other methods that get called that also have "Locscreen" state changes, then they may "unlock" the locked screen, and cause weird visual occurrences. The other is, OLE controls don't "respect" this state either. So if you have OLE objects on your screen, you may need to create other methods and call them explicitly to keep them from flashing during a refresh as well.
It's best to Lock it in once place only, and unlock it in another after complete. This can be challenging.

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top