Page 1 of 1

visualstyle in grid ?

Posted: Fri May 24, 2019 11:33 pm
by paulcarpenter
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.

Re: visualstyle in grid ?

Posted: Mon May 27, 2019 4:02 pm
by Dominik
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)

Re: visualstyle in grid ?

Posted: Thu Jun 06, 2019 4:44 pm
by René Houba
This is also possible Paul:

If_ref com(#grid1.CurrentItem.cell<5>.VisualStyle) is(*instance_of #spvs0020)