Sign in to follow this  
Followers 0
TommyDDR

[..] GUICtrlSetBkColor + Slider

5 posts in this topic

#1 ·  Posted (edited)

Hi,

I just try to create a slider and change his background color and realise that GUICtrlSetBkColor on a slider put the focus on the windows of that slider.

I would like to know if that is a bug or normal effect of GUICtrlSetBkColor.

If you want to try this :

#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Dim $Gui
$Gui = GUICreate("test", 300, 300)
$test = GUICtrlCreateSlider(10, 10, 280, 20)
GUICtrlSetBkColor($test, 0xFFFFFF)
GUISetOnEvent($GUI_EVENT_CLOSE, "quit")
GUISetState(@SW_SHOWNA)

While(True)
    Sleep(10)
WEnd

Func quit()
    Exit
EndFunc

Thanks

Edited by TommyDDR

_GUIRegisterMsg (Register more than 1 time the same Msg), _Resize_Window (GUICtrlSetResizing for children windows), _GUICtrlSetOnHover (Link a function when mouse go on, left, clic down, clic up, on a control), _InputHeure (Create an input for hour contain), _GUICtrlCalendar (Make a complete calendar), _GUICtrlCreateGraphic3D (Create a 3D graph), _ArrayEx.au3 (Array management), _GUIXViewEx.au3 (List/Tree View management).

Share this post


Link to post
Share on other sites



TommyDDR,

I think what you are seeing is not the result of GUICtrlSetBkColor specifically, but the unwelcome application of the WM_SETFOCUS message to the slider control. Take a look at the NoFocusLines UDF in my sig for more info on this - and how to prevent it. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thank's for your answer, i've try to use your code but no result...

#include <GUIConstantsEx.au3>
#include "NoFocusLines.au3"
Opt("GUIOnEventMode", 1)

Dim $Gui
$Gui = GUICreate("test", 300, 300)
$Slider = GUICtrlCreateSlider(10, 10, 280, 20)
GUISetOnEvent($GUI_EVENT_CLOSE, "quit")
GUISetState(@SW_SHOWNA)
ConsoleWrite(_NoFocusLines_Set($Slider) & @CRLF)

Sleep(1000)
GUICtrlSetBkColor($Slider, 0xFF0000)

While(True)
    Sleep(10)
WEnd

Func quit()
    Exit
EndFunc
Edited by TommyDDR

_GUIRegisterMsg (Register more than 1 time the same Msg), _Resize_Window (GUICtrlSetResizing for children windows), _GUICtrlSetOnHover (Link a function when mouse go on, left, clic down, clic up, on a control), _InputHeure (Create an input for hour contain), _GUICtrlCalendar (Make a complete calendar), _GUICtrlCreateGraphic3D (Create a 3D graph), _ArrayEx.au3 (Array management), _GUIXViewEx.au3 (List/Tree View management).

Share this post


Link to post
Share on other sites

TommyDDR,

I know that colouring buttons makes them behave strangely because of a bug deep within the core AutoIt code - it looks like you have found another problem with the way colouring controls was implemented. You might want to raise a Trac ticket for it, but I fear the answer will be the same as for the button - "too difficult to fix". ;)

Sorry not to be of more help - do you have to colour the slider? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I have a slider in a tab item but the background of the slider is same as the background of the windows (not same as the tab item), so i change bkcolor of slider (yes, it's messy, but i don't find another way).

Thank you for yours replies :)

Edited by TommyDDR

_GUIRegisterMsg (Register more than 1 time the same Msg), _Resize_Window (GUICtrlSetResizing for children windows), _GUICtrlSetOnHover (Link a function when mouse go on, left, clic down, clic up, on a control), _InputHeure (Create an input for hour contain), _GUICtrlCalendar (Make a complete calendar), _GUICtrlCreateGraphic3D (Create a 3D graph), _ArrayEx.au3 (Array management), _GUIXViewEx.au3 (List/Tree View management).

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0