×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

GRID Refresh problems

GRID Refresh problems

GRID Refresh problems

(OP)
I have a form with Grid1.Column1.DynamicBackColor = IIF(RECNO([TABLE])=THISFORM.nTABLE,RGB(0,0,128),RGB(255,255,255))
and Grid1.Column1.DynamicForeColor =
IIF(RECNO([TABLE])=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

RE: GRID Refresh problems

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.

Robert Bradley

FoxDev - Visual FoxPro Development

RE: GRID Refresh problems

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.

Jon Hawkins
jonscott8@yahoo.com

Carpe Diem! - Seize the Day!

RE: GRID Refresh problems

(OP)
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

RE: GRID Refresh problems

  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.

RE: GRID Refresh problems

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close