View Full Version : button color not refreshing?

09-30-2009, 12:40 PM
I am setting a handful of widget buttons to a different base color. Here is my code:

status=WwSetValue(btnBrowse, background='light gray')
status=WwSetValue(btnStart, background='light gray')
status=WwSetValue(btnAccept, background='green')
status=WwSetValue(btnDelete, background='green')
status=WwSetValue(btnRestart, background='green')
status=WwSetValue(btnFinish, background='red')

Everything is working and the status is coming back as 1. But I only see a color change if I take another window and slide it over my GUI and back. Almost like its not refreshing or something.

Any ideas why this would be happening.?


10-01-2009, 04:15 PM
I have done some testing and found out that there is a problem with setting the background color
of the parent widget of a button on Windows. I will file a change request for this issue.

In the meantime, try the following workaround:

PRO ButtonCB, wid, data
parent_wid = WwGetValue(wid, /Parent)
status = WwSetValue(parent_wid, background='blue')
status = WwSetValue(parent_wid, /Hide)
status = WwSetValue(parent_wid, /Show)

PRO bbox_bgcolor_test
top=WwInit('bbox_bgcolor_test', 'Examples', layout, /Vertical)

label1 = ['Browse']
btnBrowse = WwButtonBox(layout, label1,'ButtonCB')
label2 = ['Accept']
btnAccept = WwButtonBox(layout, label2,'ButtonCB')
label3 = ['Finish']
btnFinish = WwButtonBox(layout, label3,'ButtonCB')

status = WwSetValue(btnBrowse, background='light gray')
status = WwSetValue(btnAccept, background='green')
status = WwSetValue(btnFinish, background='red')

status = WwSetValue(top, /Display)

Hope this helps.