Listbox: Change selection color
thomas_braun
I'm using a listbox with colored text.
Function Dostuff()
Make/T/N=(5,1) tw= "row "+num2str(p) // 5 row, 1 col text wave (2D)
Make/B/U/N=(5,1,2) sw // 5 row, 1 col, 2 plane byte wave
Make/O/W/U myColors= {{0,0,0},{65535,0,0},{0,65535,0},{0,0,65535},{0,65535,65535}}
MatrixTranspose myColors // above was easier to enter as 3 rows, 5 cols
NewPanel
ListBox lb,mode=3,listWave= tw,selWave= sw,size={200,100},colorWave=myColors
sw[][][1]= p // arbitrary index values into plane 1
// now, execute the following one at a time and observe the results
SetDimLabel 2,1,backColors,sw // define plane 1 as background colors
SetDimLabel 2,1,foreColors,sw // redefine plane 1 s foreground colors
sw[][][%foreColors]= 4-p // change the color index values
End
Make/T/N=(5,1) tw= "row "+num2str(p) // 5 row, 1 col text wave (2D)
Make/B/U/N=(5,1,2) sw // 5 row, 1 col, 2 plane byte wave
Make/O/W/U myColors= {{0,0,0},{65535,0,0},{0,65535,0},{0,0,65535},{0,65535,65535}}
MatrixTranspose myColors // above was easier to enter as 3 rows, 5 cols
NewPanel
ListBox lb,mode=3,listWave= tw,selWave= sw,size={200,100},colorWave=myColors
sw[][][1]= p // arbitrary index values into plane 1
// now, execute the following one at a time and observe the results
SetDimLabel 2,1,backColors,sw // define plane 1 as background colors
SetDimLabel 2,1,foreColors,sw // redefine plane 1 s foreground colors
sw[][][%foreColors]= 4-p // change the color index values
End
And that text color conveys information.
Now if a user selects row 2 the text color is changed to pink which looks a lot like red. I know that having the colors changed to be properly visible is a good thing in general. But here I would need to have something like a bounding rectangle instead of an all blue for the selection. Or can I change the opacity of the selection blue?
The selection hilite color is what we are told to use by the OS for a selection. On Macintosh, you can change it in the system preferences. On Windows it's fixed. It would take some work to uncook the drawing code and provide the flexibility you want.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
May 24, 2018 at 02:11 pm - Permalink
May 24, 2018 at 02:38 pm - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
May 24, 2018 at 04:13 pm - Permalink