Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Russell Hill
  Where is Russell Hill?
 Sydney
 Australia
 Russell Hill
 To: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 Tags
Subject: RE: Backcolor in a Grid
Thread ID: 268861 Message ID: 268927 # Views: 29 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Thursday, July 15, 2010 1:45:27 PM         
   


> > The problem is that the selected cell in the Calendar is no longer highlighted (see below) when there IS data detected. I think this is simply because the Grid has lost focus, whereas it hasn't in the situation where no data is detected.
> >
> >
> > Does anyone have any suggestions as to how I would get the highlight to remain even in the case where SQL is executed? I need the RHS Grid to have focus (it's .AfterRowColChange method drives another Grid lower down) so the simple solution of returning focus to the Calendar Grid is no good to me.
> >
> > Any suggestions would be appreciated.
> >
> > Thanks,
> >
> > Russell.
>
> Russell,
> Another control having the focus wouldn't explain it. It may be a simple missing 'refresh'. If focus would be your cure then you could do something like this:
>
>
thisform.myGrid.SetFocus()
> this.Setfocus()
> 

> On object stealing the focus. IMHO first be sure that your conditions to color that cell still holds true (ie: unintentionally moved to somewhere like EOF). Here is code that demonstrates that it is not a matter of not having focus:
>
>
Public oForm
> oForm = Createobject('SampleForm')
> oForm.Show()
> 
> Define Class SampleForm As Form
>   DataSession = 2
>   Height=400
>   Width=700
>   Add Object myGrid As Grid With ;
>     height=400,Width=600,;
>     recordSourcetype=4,;
>     recordsource='select * from ("'+_samples+'data\Customer") into cursor xx nofilter'
> 
>   Add Object txtDummy As TextBox With Left=620,Top = 10
> 
>   Procedure myGrid.Init
>     This.AddProperty('recno',0)
>     Local ix
>     For ix=2 To 3 && coloring only 2,3rd columns
>       With This.Columns(m.ix)
>         .DynamicBackColor = '(IIF(this.recno = RECNO(),0xFF0000,0xFFFFFF))'
>         .DynamicForeColor = '(IIF(this.recno = RECNO(),0xFFFFFF,0x000000))'
>         .Sparse = .F.
>         .AutoFit()
>       Endwith
>     Endfor
>   Endproc
> 
>   Procedure myGrid.AfterRowColChange(nIndex)
>     This.Recno = Recno()
>     this.Refresh()
>   Endproc
> Enddefine
> 

>
>
> Cetin Basoz
>
> .Net has got better.Think about moving - check my blog:
> Blog (main)
> Blog (mirror)

Thanks a lot Cetin.

I'll get back to you.

Regards,

Russell.

ENTIRE THREAD

Backcolor in a Grid Posted by Russell Hill @ 7/15/2010 4:50:58 AM
RE: Backcolor in a Grid Posted by Rahul Maudgill @ 7/15/2010 6:15:39 AM
RE: Backcolor in a Grid Posted by Russell Hill @ 7/15/2010 7:58:15 AM
RE: Backcolor in a Grid Posted by Rahul Maudgill @ 7/15/2010 11:59:28 AM
RE: Backcolor in a Grid Posted by Russell Hill @ 7/15/2010 1:43:08 PM
RE: Backcolor in a Grid Posted by Chris Chamberlain @ 7/15/2010 9:42:34 AM
RE: Backcolor in a Grid Posted by Russell Hill @ 7/15/2010 11:31:11 AM
RE: Backcolor in a Grid Posted by Cetin Basoz @ 7/15/2010 11:44:08 AM
RE: Backcolor in a Grid Posted by Russell Hill @ 7/15/2010 1:45:27 PM