Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic methods in a Grid
Message
From
23/08/2001 08:32:28
 
 
To
23/08/2001 03:55:43
Wilfred Chan
Bnp Paribas Hong Kong Branch
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00547786
Message ID:
00547860
Views:
7
Hi Wilfred,


That is didactic materials for grid object on web in almost all sites.

But, here is some instance of code that was part of a publishing on the Microsoft´s http:/msdn.microsoft.com/vfoxpro site:
 with This   && SETING THE COLORS AND RECORDSOURCE
   if .HighlightRow 
     if not empty(.RecordSource) 
       .ColumnGotFocus() 
     endif
     .nBackColor = .BackColor 
     .SetAll('DynamicBackColor', ; 
       'iif(recno(This.RecordSource) = This.nRecno, ' + ; 
       'rgb(' + .cSelectedBackColor +'), ' + ; 
       ltrim(str(.BackColor)) + ')') 
   endif
 endwith 


 local lcOrder, ; 
   lcAlias, ; 
   lnRecno 
 dodefault() 
 with This 
   if not empty(.cDisplayTag) or not empty(.cSeekTag) 
     lcOrder = iif(empty(.cDisplayTag), .cSeekTag, ; 
       .cDisplayTag) 
     lcAlias = .Parent.Parent.RecordSource 
     if not upper(order(lcAlias)) == upper(lcOrder) 
       set order to (lcOrder) in (lcAlias) 
       lnRecno = recno(lcAlias) 
       Thisform.LockScreen = .T. 
       .Parent.Parent.Refresh() 
       .Reposition(lnRecno, lcAlias) 
       .Parent.Parent.Refresh() 
       Thisform.LockScreen = .F. 
     endif not upper(order(lcAlias)) == upper(lcOrder) 
   endif not empty(.cDisplayTag) ... 
 endwith 

 


 local laColumns[1], ; 
   lnSelect, ; 
   lcKeyExpr, ; 
   luKeyValue, ; 
   lcDatabase, ; 
   lcAlias, ; 
   loLookup 
 with This 
  
 * Ensure the aColumns array has been properly set up, 
 * the specified table is open, and the tag is defined. 
  
   assert type('.aColumns[1, 1]') = 'C' and ; 
     not empty(.aColumns[1, 1]) ; 
     message 'SFPickListButton: aColumns not set up' 
   assert type('.cAlias') = 'C' and ; 
     not empty(.cAlias) and used(.cAlias) ; 
     message 'SFPickListButton: cAlias not properly ' + ; 
     'specified' 
   assert type('.cTag') = 'C' and not empty(.cTag) and ; 
     tagno(.cTag, '', .cAlias) > 0 ; 
     message 'SFPickListButton: cTag not properly ' + ; 
     'specified' 
  
 * Set up the parameters we'll pass to the  
 * SFPickList class. 
  
   acopy(.aColumns, laColumns) 
   lnSelect = select() 
   select (.cAlias) 
   lcKeyExpr  = key(tagno(.cTag)) 
   luKeyValue = evaluate(lcKeyExpr) 
   lcDatabase = cursorgetprop('Database') 
   lcAlias    = iif(empty(lcDatabase), '', ; 
     lcDatabase + '!') + .cAlias 
   select (lnSelect) 
  
 * Create the pick list and display it. 
  
   loLookup = newobject('SFPickList', 'SFForms.vcx', '', ; 
     lcAlias, ; 
     @laColumns, ; 
     .cCaption, ; 
     lcKeyExpr, ; 
     luKeyValue, ; 
     .cTag) 
   loLookup.Show() 
  
 * If the user selected a record, find it and refresh 
 * the form. 
  
   if type('loLookup') = 'O' and ; 
     not isnull(loLookup) and loLookup.lSelected 
     = seek(loLookup.uKeyValue, .cAlias, .cTag) 
     Thisform.RefreshForm() 
   endif type('loLookup') = 'O' ... 
 endwith 

 

 with This 
   dimension .aColumns[3, 5] 
   .aColumns[1, 1] = 'customer.company' 
 * .aColumns[1, 2] = 150 
 * .aColumns[1, 3] = 'Company' 
   .aColumns[1, 5] = 'company' 
   .aColumns[2, 1] = 'customer.city' 
 * .aColumns[2, 2] = 100 
 * .aColumns[2, 3] = 'City' 
   .aColumns[2, 5] = 'city' 
   .aColumns[3, 1] = 'customer.contact' 
 * .aColumns[3, 2] = 100 
 * .aColumns[3, 3] = 'Contact' 
 endwith 

 
This article is reproduced from the November 1998 issue of FoxTalk. Copyright
1998, by Pinnacle Publishing, Inc., unless otherwise noted. All rights are
reserved. FoxTalk is an independently produced publication of Pinnacle
Publishing, Inc. No part of this article may be used or reproduced in any
fashion (except in brief quotations used in critical articles and reviews)
without prior consent of Pinnacle Publishing, Inc. To contact Pinnacle
Publishing, Inc., please call 1-800-788-1900.


------------------------------------------------------------------------------

© 2000 Microsoft Corporation. All rights reserved. Terms of use.
CLAUDIO
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform