Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid, how to know its bound cursor
Message
From
21/01/2003 04:59:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00743210
Message ID:
00743684
Views:
19
>>Esparta,
>>For what it's worth I'd add a property named CursorName :
>.CursorName = sys(2015)
>.RecordSource = "SELECT * from Customer INTO CURSOR "+.CursorName
>
>It is for a generic enhaced Grid Class, I now I can use the property, but I just want to save some brain cells <g> I mean, no have to remember to fill the cursor name I suppose to get, just do it as I been done in this time: Setting recordSource & RecordSourceType, the hard work will be done by the GridClass knowing the real binded cursor no matter if it was an Alias, DBF o SQL Statement.
>
>Now I'm seeing this is not so easy as I though, so I'll have to use the property anyway. I already try the Vlad's recomendation with no hit :(

Esparta,
I say use a property because 'been there done that' :)
Checking controlsource works, however you should do that at a point and on a column which you're sure not touched (controlsource might not be in form usedalias.fieldname) yet. To workaround the issue I did this (roughly) :
*GetGridCursor
with myGrid
 lnRecType = .recordsourcetype
 lcRecordsource = .recordsource
 .recordsource = ''
endwith

if lnRecType > 2
  thisform.addobject('dummy','grid') && Create a dummy one
  with thisform.dummy
    .recordsourcetype = lntype
    .recordsource = lcRecordsource && Populate
    lcCursorName = juststem(.columns(1).controlsource) && Get cursorname
  endwith
  thisform.removeobject('dummy') && Drop dummy
else
  lcCursorName = .recordsource
endif

myGrid.RecordSource = lcRecordsource
In most cases it doesn't worth to do all these (like using a sys(2015) for cursorname). I could just store it to a property :)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform