Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setall for methods
Message
De
31/05/1999 12:46:26
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00224567
Message ID:
00224693
Vues:
17
>>>Is there a way to set a method at runtime, like Setall() for properties?
>>There is no direct way. You should loop through the controls and explicitly execute the method.
>
>I need the Mousemove event of all columns in all grids to have a specific code snippet. The ideal way to do this is ofcourse through inheritance (classes), but I build my grids visually through the form builder, which doesn't allow the grid columns to inherit from another class than the VFP base column class. Is there a way around this?
Vidar,
There is a workaround but might be painfull if you don't design for it from the beginning. You could build the grid with your own builder.
A simpler way till a builder is available is follows (an extremely simple builder) :
* GridCols.prg
lparameters tcMethodName, tcMethodCode
ASELOBJ(oGrids) && Get ref to selected objects in form designer
FOR each oGrid in oGrids
  IF !oGrid.baseclass = "Grid" && Is it really a grid ?
    LOOP
  ENDIF
  FOR each oColumn in oGrid.columns
  	oColumn.WriteMethod(tcMethodName, tcMethodCode)
  ENDFOR
ENDFOR
ie : Put grid(s) on a form and build as normal. Select one or more grids, go to command window :
=gridcols("MouseMove","wait window this.name nowait")

Now the other side of the coin. Grid columns wouldn't have the mousemove event easily despite you all change columns' code. Mouse events change focus when a grid control has already focus and not have focus yet. ie: Mousemove events would work when grid doesn't have focus at all, or activecontrol is a grid control with column = 5, row = 4. Mousemove would work for all the columns again except it wouldn't work when mouse comes over selected control (column5, row4). This shouldn't be much problem though.
And this is only for mousemove, do not take this explanation for all mouse events (ie: click).
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform