visualstyle in grid ?

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Posts: 3
Joined: Fri May 24, 2019 11:14 pm

visualstyle in grid ?

Post by paulcarpenter » Fri May 24, 2019 11:33 pm

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.

Posts: 12
Joined: Fri Jun 10, 2016 12:14 pm

Re: visualstyle in grid ?

Post by Dominik » Mon May 27, 2019 4:02 pm

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
If (#Grid1.CurrentItem.VisualStyle *IsNot *Null)
#StyleName := #Grid1.CurrentItem.VisualStyle.Name
If (#Grid1.VisualStyle *IsNot *Null)
#StyleName := #Grid1.VisualStyle.Name
#StyleName := 'NULL'
Use Builtin(OV_MESSAGE_BOX) With_Args(#StyleName)

René Houba
Posts: 60
Joined: Thu Nov 26, 2015 7:03 am

Re: visualstyle in grid ?

Post by René Houba » Thu Jun 06, 2019 4:44 pm

This is also possible Paul:

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

Post Reply