Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Making grid highlighting match the current record
Message
From
09/04/1998 13:11:25
 
 
To
09/04/1998 12:00:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00090597
Message ID:
00090848
Views:
33
When I added the code you suggested (and took out the When event code), I got the following message (5 times which is the number of columns I have): "Expression invalid. Use a valid expression for DynamicBackColor property." Everything looks ok, when the grid first displays (i.e. it still shows the highlighting on the first column), but the error message displays as soon as I try to exit from the displayed first row and click on another row in the grid.


>>>>>>I have a data entry form on Page 1. On page 3 I have a grid. I have some code in the grid init which highlights the current row when I click on the grid. But I'd also like the correct row in the grid to be selected when I go to Page 1 and select a record, then click on Page 3. I thought I should do this in the click event for Page 3, but I'm not sure if anything I reference in the grid at that point is valid since when I click on the page I'm not actually in the grid. Does anybody have any hints or tips with this?
>>>>>>
>>>>>>Thanks,
>>>>>>
>>>>>>Sylvia
>>>>>
>>>>>Could you post actual code you use for DynamicBackColor setting?
>>>>
>>>>***This is the code which is in my Grid Init event
>>>>ThisForm.r_nCurrentRow = RECNO(This.RecordSource)
>>>>This.Setall("DynamicBackColor", ;
>>>> "IIF(RECNO(This.Recordsource) = " + ;
>>>> "ThisForm.r_nCurrentRow, " + ;
>>>> "RGB(0,255,255), RGB(255,255,255))", ;
>>>> "Column")
>>>>
>>>>***In the When event of each item contained in the grid column, I have
>>>>ThisForm.r_nCurrentRow = RECNO(This.Parent.Parent.RecordSource)
>>>>
>>>>I thought by putting a variation of this into my Click event on the Page, I could update the grid 'marker' as soon as I clicked on the page. But the marker remains 'stuck' on the first item.
>>>
>>>Add following code:
>>>***Grid.Afterrowcolchange event
>>>thisform.r_nCurrentRow=RECNO(This.RecordSource)
>>>this.refresh
>>>Now you can eliminate code from When events, but add into Page.Activate event:
>>>This.Grid.Afterrowcolchange()
>>
>>I got the code from a class I took. The reason it was recommended to use the When event in the column controls, was that using the grid refresh method took a lot of time (particularly when the display area gets larger). Does the code above have the effect of refreshing the grid as soon as you hit the page?
>
>As I mentioned you should put This.Grid.Afterrowcolchange() to Page.Activate event. This will provide resetting. You shouldn't worry about the time to get refreshing, if you issue Page.Refresh you will waste much more time. Also, When event is not highly recommended to use. Also, the real grid should also contain mechanism to recognize row or column change and fire Grid.Refresh only in a case of row change.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform