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!

*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.

Jobs

Grids

How to make grid display current row in distinct color? by ramani
Posted: 10 Nov 01 (Edited 20 Apr 03)

**********************************************************
** How to make grid display current row in distinct color?
**********************************************************
** by Subramanian.G (ramani)
**    FoxAcc Software
**    ramani_g@yahoo.com
**********************************************************

At the form level create a variable,say, inRecNo and put the initial value as 0 . Add code as suggested below ..


MyGrid.InitEvent
****************
DODEFAULT()
WITH THIS
   .SetAll("DynamicBackColor", ;
       "IIF(recno(This.RecordSource)=ThisForm.inRecno, ;
            RGB(0,255,255),RGB(255,255,192))","COLUMN")
ENDWITH

MyGrid.AfterRowColChangeEvent
*****************************
DODEFAULT()
ThisForm.inRecNo = RECNO()
This.Columns(This.ActiveColumn).Text1.BackColor = RGB(0,255,255)
This.Refresh()

**********************************************************
This will make the back color of the row your are editing in the grid.. to SkyBlue. while the rest of the records will have a distinct cream/yellow.
**********************************************************
OR alternative method
**********************************************************
MyGrid.InitEvent
****************
DODEFAULT()
WITH THIS
   .SetAll("DynamicBackColor", ;
       "IIF(recno(This.RecordSource)=ThisForm.inRecno, ;
            RGB(0,255,255),RGB(255,255,192))","COLUMN")
ENDWITH
nColumncount=This.ColumnCount
For I=1 To nColumncount
    Objref=Eval('this.columns(i).'+ ;
                     This.column1.CurrentControl)
    Objref.BackColor=RGB(0,255,255)
    Objref.SelectedBackColor=RGB(0,255,255)
    Objref.SelectedForecolor = RGB(0,0,0)
Endfor
********************************************************* *********************************************************
** EOF **
** Ramani (Subramanian.G), FoxAcc, ramani_g@yahoo.com
**********************************************************
Evaluate this to make others know how useful is this

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

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