[Closed] Change rollout color dynamically
I am trying to change the background color of a rollout dynamically. I have a colorpicker that I want to use to change the rollout colour. How can I do this without having to destroy and create the dialog. I can’t seem to acces the rollout color after its created?
thanks
As it looks to me the bgcolor property of a dialog can only be set on creation.
however, you can use a bitmap for the bgcolor and then use the ‘SetDialogBitmap’ method to change the color, like in this example:
rollout testRollout "rollout"
(
-- Local Variable Declerations
------------------------------------------
local w = 200
local h = 50
local bgMap = bitmap w h color:white
-- User Interface
------------------------------------------
colorPicker cpBG "BG Color:"
-- Functions
------------------------------------------
fn changeBGColor col =
(
bgMap = bitmap w h color:col
SetDialogBitmap testRollout bgMap
)
fn openDialog =
(
createDialog testRollout width:w height:h bitmap:bgMap
)
-- Event Handlers
------------------------------------------
on cpBG changed col do changeBGColor col
) -- end of rollout
testRollout.openDialog()
And it immediately shows that the bitmap is not gamma corrected and the color picker is! When you use gamma settings of course.
-Johan
That really really needs to be fixed ASAP.
It’s retarded that all of my buttons etc are wackobizzaro gamma-ed.
as annoying as that is, surely a very swift getPixels -> apply gamma -> setPixels will take care of that?
Zeboxx you’re right and in this instance you can even replace the changeBGColor fn
fn changeBGColor col =
(
bgMap = bitmap w h color:col gamma:(IDisplayGamma.gamma)
SetDialogBitmap testRollout bgMap
)
-Johan
Thanks TZMtn. Thats is a good work around. Too bad you can’t change the position. Oh well. I could try using a normal bitmap to.
The position of the bitmap using SetDialogBitmap. I have a toolbar in the window. It looks a bit weird having different colours undeneith the buttons.
Well you could setpixels per row for only the upper rows… and change the colors to something more appropriate.
-Johan