Achilles Posted August 15, 2008 Share Posted August 15, 2008 Setting the bk color of a showing slider works fine. When the slider is hidden it doesn't redraw the item so the slider, when shown, has the previous background color which updates as soon as you click on the slider... Is there a way to make it redraw when it's hidden? For example, this starts off black, do the following to see the error: Click the hide button to hide the slider, then change the background, then show the slider... expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <SliderConstants.au3> $color = 0 $showing = True GUICreate('Slider', 300, 100) ; will create a dialog box that when displayed is centered GUISetBKColor($color) $slider = GUICtrlCreateSlider(10, 10, 280, 30, $TBS_HORZ + $TBS_NOTICKS) GUICtrlSetBkColor(-1, $color) $btn = GUICtrlCreateButton('Switch BK color', 10, 50, 135, 25) $btn2 = GUICtrlCreateButton('Hide/Show slider', 155, 50, 135, 25) GUISetState() While 1 Switch GUIGetMsg() Case $btn If $color = 0 then $color = '0xFFFFFF' Else $color = 0 EndIf GUISetBkColor($color) GUICtrlSetBkColor($slider, $color) Case $btn2 $showing = Not $showing If $showing then GUICtrlSetState($slider, $GUI_SHOW) Else GUICtrlSetState($slider, $GUI_HIDE) EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Malkey Posted August 15, 2008 Share Posted August 15, 2008 Setting the bk color of a showing slider works fine. When the slider is hidden it doesn't redraw the item so the slider, when shown, has the previous background color which updates as soon as you click on the slider... Is there a way to make it redraw when it's hidden? For example, this starts off black, do the following to see the error: Click the hide button to hide the slider, then change the background, then show the slider... expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <SliderConstants.au3> $color = 0 $showing = True GUICreate('Slider', 300, 100); will create a dialog box that when displayed is centered GUISetBKColor($color) $slider = GUICtrlCreateSlider(10, 10, 280, 30, $TBS_HORZ + $TBS_NOTICKS) GUICtrlSetBkColor(-1, $color) $btn = GUICtrlCreateButton('Switch BK color', 10, 50, 135, 25) $btn2 = GUICtrlCreateButton('Hide/Show slider', 155, 50, 135, 25) GUISetState() While 1 Switch GUIGetMsg() Case $btn If $color = 0 then $color = '0xFFFFFF' Else $color = 0 EndIf GUISetBkColor($color) GUICtrlSetBkColor($slider, $color) Case $btn2 $showing = Not $showing If $showing then GUICtrlSetState($slider, $GUI_SHOW) Else GUICtrlSetState($slider, $GUI_HIDE) EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd What about as soon as the slider is $GUI_SHOW, use GUICtrlSetBkColor($slider, $color) then. Case $btn2 $showing = Not $showing If $showing then GUICtrlSetState($slider, $GUI_SHOW) GUICtrlSetBkColor($slider, $color) Else GUICtrlSetState($slider, $GUI_HIDE) EndIf Link to comment Share on other sites More sharing options...
Achilles Posted August 15, 2008 Author Share Posted August 15, 2008 Hmm, that sounds like my best solution right now... I'll go with that if I don't find something else.. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Malkey Posted August 15, 2008 Share Posted August 15, 2008 You were right. On my xp, I could not set the background color of a hidden slider. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now