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!

GRID Refresh problems

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
I have a form with Grid1.Column1.DynamicBackColor = IIF(RECNO(
)=THISFORM.nTABLE,RGB(0,0,128),RGB(255,255,255))
and Grid1.Column1.DynamicForeColor =
IIF(RECNO(
)=THISFORM.nTABLE,RGB(255,255,255),RGB(0,0,0))

Unfortunately, for reasons various, it takes between 2 or 3 seconds to load each record, during which time 2 or more records, (if scrolled thru on up/dn arrow keys), may have a fore/background of RGB(255,255,255)/RGB(0,0,128), which is unsightly and could be unnerving to the inexperienced.

Once the loading is complete, all is normal.

What I am trying to acheive is one record with fore/background of RGB(255,255,255)/RGB(0,0,128) at a time.

TIA

Chris
 
Well, Chris, you'll probably think this sounds goofy, but it's one way I've used to solve an issue somewhat related to what you have:

Add a Timer control to the form; set the interval to something like 2 seconds, and when it fires then set the colors. That should take care of the rapid scrolling.

Another option (one I haven't tried) is doing something with the AfterRowColChange event.
 
There are many ways you could attack this,but most of the solutions(that I can think of) are going to involve waiting for the grid to populate.

Don't display the grid(or form) until the grid has been populated completely and use a thermal bar to display progress to the user.

Don't set the DynamicBackColor property of the columns until
the grid has been populated.

Disable the grid until it has been populated.

You may wanna provide more detail on how you are populating the grid's recordsource and why the longevity for loading each record.
 
Robert & Jon

Thanks for your ideas. Its difficult to see the wood for the trees sometimes if you are too close to a problem.

The events are processed in the .AfterRowColChange event.

Logic indicates that the white/navy blue colours need to be set to black/white BEFORE the lengthy processing takes place.

The following code works:-

lnMarker = RECNO() && Newly selected record

* Go to the old record and set colours to black/white
GOTO THISFORM.nTable && Old RECNO()
THISFORM.nTable = 0 && Set to invalid record
THISFORM.Grid1.Refresh()
APPEND This memo && Update old record
APPEND That memo && Update old record

* Go to the selected record and set colours to white/navy blue
GOTO lnMarker
THISFORM.nTable = RECNO() && Set to current record
THISFORM.Grid1.Refresh()
COPY MEMO This && Refresh new record
COPY MEMO That && Refresh new record
*-- Other Code

The lengthy process comes from the fact that MEMO fields are appended to the table, copied back to the hard drive, a report is opened as table, SCAN ... ENDSCAN on the table, image control get new file reference, toolbar gets alternative controls, form refresh, etc, etc.

The cursor is changed to a hourglass and a WAIT WINDOW [] NOWAIT NOCLEAR advises the user as to the title of the record being loaded.

Thanks once again and I hope someone else with a similar problem could make use of the code.

Chris
 
Did you ever tried thisform.Lockscreen property during refreshing? This allows to do not show to users any refreshing that occur on form during loading Following code in many plases help a lot.

* store old lockscreen value for case when
* some other routine already set it before
local llOldLockScreen
m.llOldLockScreen = thisform.LockScreen

* activate screen buffering
thisform.LockScreen = .T.

* Show progress bar or Wait Window
WAIT WINDOW "Loading..." NOWAIT NOCLEAR

* make all long-time data and form interface refreshing
.............

* Hide progress bar
WAIT CLEAR

* refresh content of screen
* here you may update thisform.nTable as well
thisform.Refresh

* show refreshed screen
thisform.LockScreen = m.llOldLockScreen

User will never show any interface refreshes, just form changed with another data.
 
TomasDill

Thanks for the idea concerning .LockScreen

I did try various options using it, (it is in effect on the form's .Refresh()), without improvement.

The last code posted works well, and because the load time may now only be a second or two, WAIT WINDOW has been discarded as it slows processing.

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top