how can a visual style be retrieved from a cell in a grid? i.e. how can I find out what visualstyle is applied to the cell in grid.
I apply the visual style as follows
#grid1.CurrentItem.cell<5>.VisualStyle <= #spvs0020
but later when someone clicks on the cell I need to establish the visualstyle in a variable and dependant on this, then change the visualstyle to change the colour of the cell, and update values on the grid.
visualstyle in grid ?
Re: visualstyle in grid ?
Hi Paul, are you getting some sort of error when you are trying this out? If i set the style of a grid cell, i can then retrieve it again without errors.
The issue might be that you have set the VisualStyle of the entire grid, and some specific cells in the grid... If i query the VisualStyle property of a cell that hasnt been individually set, it will give me a null result (even though the cell displays with the grid visual styling). So you need to check if the cell has a non-null style, before you can get the properties of it. For example:
Define_Com Class(#PRIM_ALPH) Name(#StyleName)
If (#Grid1.FocusCell.VisualStyle *IsNot *NULL)
#StyleName := #Grid1.FocusCell.VisualStyle.Name
Else
If (#Grid1.CurrentItem.VisualStyle *IsNot *Null)
#StyleName := #Grid1.CurrentItem.VisualStyle.Name
Else
If (#Grid1.VisualStyle *IsNot *Null)
#StyleName := #Grid1.VisualStyle.Name
Else
#StyleName := 'NULL'
Endif
Endif
Endif
Use Builtin(OV_MESSAGE_BOX) With_Args(#StyleName)
The issue might be that you have set the VisualStyle of the entire grid, and some specific cells in the grid... If i query the VisualStyle property of a cell that hasnt been individually set, it will give me a null result (even though the cell displays with the grid visual styling). So you need to check if the cell has a non-null style, before you can get the properties of it. For example:
Define_Com Class(#PRIM_ALPH) Name(#StyleName)
If (#Grid1.FocusCell.VisualStyle *IsNot *NULL)
#StyleName := #Grid1.FocusCell.VisualStyle.Name
Else
If (#Grid1.CurrentItem.VisualStyle *IsNot *Null)
#StyleName := #Grid1.CurrentItem.VisualStyle.Name
Else
If (#Grid1.VisualStyle *IsNot *Null)
#StyleName := #Grid1.VisualStyle.Name
Else
#StyleName := 'NULL'
Endif
Endif
Endif
Use Builtin(OV_MESSAGE_BOX) With_Args(#StyleName)
-
René Houba
- Posts: 220
- Joined: Thu Nov 26, 2015 7:03 am
Re: visualstyle in grid ?
This is also possible Paul:
If_ref com(#grid1.CurrentItem.cell<5>.VisualStyle) is(*instance_of #spvs0020)
If_ref com(#grid1.CurrentItem.cell<5>.VisualStyle) is(*instance_of #spvs0020)