Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Record pointer in grid without focus
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00044481
Message ID:
00044756
Views:
37
>>>>>We're getting closer, I think. I made a form property gridcurrec, which I hope might have wide scope. My expression in .DynamicBackColor is recno()=THISFORM.gridcurrec. Somewhere, I need to put THISFORM.gridcurrec = recno('gridalias'). Grids don't have a .lostfocus event, and I think the controls inside the grid will think all RECNO()s in the grid are RECNO(), if you know what I mean.
>>>>
>>>>As Edward says, use AfterRowColChange. Here's some more complete code (now that I have time)...this will use whatever selection colors the user has set.
>>>>
>>>>*cursor/table is selected
>>>>*rgbColorB & F are user's default selected colors picked up from a textbox.
>>>>*The empty string says to do nothing (use your grid/column colors) if IIF is .F.
>>>>
>>>>nRec = recno()
>>>>this.SetAll("DynamicBackColor",;
>>>>"IIF(recno()=nRec,rgbColorB,'')","Column")
>>>>this.SetAll("DynamicForeColor",;
>>>>"IIF(recno()=nRec,rgbColorF,'')","Column")
>>>>this.refresh
>>>>
>>>>
>>>>You can call this from outside grid as needed...
>>>When I tried your code I got an "Expression is invalid. Use a valid expression for DynamicForeColor property" and a similar one for DynamicBackColor. Since I use vfp3 and could find no documentation for rgbColorF and B, I replaced them with rgb(50,50,50) and rgb(150,150,150). Same error. What's its problem?
>>
>>I copied this from one my form:
>>create cursor tmpdtlquery (uc C(2), titlepart C(30), numsoc C(8), durshare C(10),caenum C(14), titleflag L, shareerr L)
>>cBackcolorline="IIF(tmpdtlquery.titleflag=.T.,16711680,16777215)"
>>cForecolorline="IIF(tmpdtlquery.titleflag=.T.,16777215,0)"
>>with this.grDtlquery
>> .recordsource="tmpdtlquery"
>> .setall("DynamicBackColor",cBackcolorline,"Column")
>> .setall("DynamicForeColor",cForecolorline,"Column")
>>endwith
>>
>>HTH
>That's interesting, but not quite the answer I'm looking for. The task here is to make the grid highlight the current recno() in the grid when the grid doesn't have focus. Mr. Bureaucrat's code looks like just the thing, except that it isn't working. My experiments suggest that the DynamicBackColor property doesn't like having RECNO() in the IIF(), which seems so picky that I would call it a bug. If true, it ruins the idea. The reason for doing all this is another grid I have which contains the children for the selected record in the first grid. I want the user to be able to see whose children are in grid2. I know there are other ways to make it all happen, but it seems like we're so close here.

You misunderstood me. The only purpose of the code is to show you how to use Dynamic... syntax (don't use rgb()!). Any other things from the thread (btw I participated there too) including recno() are still applied.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform