Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Default Grid a possibility?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00160820
Message ID:
00161151
Views:
20
>Pete,
>
>In VFP5/6 you can use Tools, Options, Field Mapping, Multiple to use your own grid class.
>
>When you drop a grid onto a form it only takes the properties of the DBC that are there at that instant, it doesn't read them dynamically from the DBC at runtime. Grids with ColumnCount = -1 will generate using the current view props. You could program your grid class to read them at runtime, or create a builder that updates your grid at design time.
>
>I use a builder like this:
>
>
lparameter plForceHeader
>
>if ( pcount() = 0 )
>   plForceHeader = .f.
>endif
>
>if ( type( "plForceHeader" ) != "L" )
>   plForceHeader = .f.
>endif
>
>local n, i
>
>n = aselobj( laJunk )
>if ( ( n != 1 ) or ( laJunk[1].BaseClass != "Grid" ) )
>   wait window nowait "Grid is not selected"
>   return
>endif
>
>atable()
>
>local lcName, lcCaption
>
>for each oCol in laJunk[1].Columns
>   i = at( ".", oCol.ControlSource )
>   if ( i > 0 )
>      lcName = dbcGetProperFieldName( oCol.ControlSource )
>      if ( ! empty( lcName ) )
>         oCol.Name = "col" + lcName
>      endif
>      if ( ( lower( oCol.Header1.Caption ) == oCol.Header1.Caption ) or ;
>           ( oCol.Header1.Caption == "Header1" ) or ;
>           empty( oCol.Header1.Caption ) or;
>           plForceHeader )
>         lcCaption = dbcGetCaption( oCol.ControlSource )
>         if ( ! empty( lcCaption ) )
>            oCol.Header1.Caption = lcCaption
>         endif
>      endif
>   endif
>endfor
>
>It works through a grid and renames the columns and updates the Header captions.
>
>I get to drink beer tomorrow seeing that I have a 6 day holiday starting... *g*

David & John
haven't had time to digest the code yet but I'm sure it's good, I think it's because there's ((so much in Foxpro and so much missing) and very little that's not achievable) that we all love it
Thanks a lot
Pete Kane
Regards,
Peter J. Kane



Pete
Previous
Reply
Map
View

Click here to load this message in the networking platform