Rex Posted April 16, 2019 Share Posted April 16, 2019 Hi I'm trying to catch when a label that has $WS_TABSTOP, is "hit" when the user uses the tab button to move between controls I'w been looking at wm_command and $EN_SETFOCUS, but that only works when the user clicks the label. I have this GUI expandcollapse popup; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ; #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiButton.au3> Global Const $hColors = GUICreate("Colors",292,282,-1,-1,BitOr($WS_POPUP, $WS_CAPTION, $WS_SYSMENU),-1) GUISetOnEvent($GUI_EVENT_CLOSE, "hWnd_Close", $hColors) GUICtrlCreateLabel("Change label colors:",8,10,100,15,-1,-1) GUICtrlSetBkColor(-1,"-2") Global Const $idColor = GUICtrlCreateDummy() GUICtrlCreateLabel("GUI BkGround:",8,36,80,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlCreateLabel("",100,36,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0x4E4E4E") GUICtrlCreateLabel("GUI Drag label:",8,60,80,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlCreateLabel("",100,60,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0x808080") GUICtrlCreateLabel("Event name:",8,84,80,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlCreateLabel("",100,84,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0xFFFFFF") GUICtrlCreateLabel("Days default:",8,108,80,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"When < 16 days left") GUICtrlCreateLabel("",100,108,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0x000000") GUICtrlCreateLabel("Days 0 to 5:",8,132,80,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"When there is 0 to 5 days left") GUICtrlCreateLabel("",100,132,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0xFF0000") GUICtrlCreateLabel("Days 6 to 10:",8,156,80,15,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"When there is 6 to 10 days left") GUICtrlCreateLabel("",100,156,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0xFFFF00") GUICtrlCreateLabel("Days 11 To 15:",8,180,80,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"When there is 11 to 15 days left") GUICtrlCreateLabel("",100,180,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0x008000") GUICtrlCreateLabel("Days label:",8,204,80,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"This is the fixed label Days") GUICtrlCreateLabel("",100,204,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0x000000") GUICtrlCreateLabel("Time Default:",142,36,100,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"When <0 days left") GUICtrlCreateLabel("",261,36,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0x000000") GUICtrlCreateLabel("Time 0 to 6:",142,60,100,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"When days = 0 and between 0 to 6 hours left") GUICtrlCreateLabel("",261,60,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0xFF0000") GUICtrlCreateLabel("Time 7 to 12",142,84,100,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"When days left = 0 and between 7 to 12 hours left") GUICtrlCreateLabel("",261,84,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0xFFFF00") GUICtrlCreateLabel("Time 13 to 23:",142,108,100,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"When days = 0 and between 13 to 23 hours left.") GUICtrlCreateLabel("",261,108,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0x008000") GUICtrlCreateLabel("Time colon:",142,132,100,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"The ':' between hour, min and sec") GUICtrlCreateLabel("",261,132,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0x000000") GUICtrlCreateLabel("Event up:",142,156,100,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"Colour of the event name, when time is up") GUICtrlCreateLabel("",261,156,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0xFF0000") GUICtrlCreateLabel("Event up BkGround:",142,180,110,20,$SS_CENTERIMAGE,-1) GUICtrlSetBkColor(-1,"-2") GUICtrlSetTip(-1,"Background colour of the Event name, when time is up") GUICtrlCreateLabel("",261,180,20,20,BitOr($WS_TABSTOP, $SS_SUNKEN),-1) GUICtrlSetOnEvent(-1,"ColorPic") GUICtrlSetBkColor(-1,"0xFFFF00") Global Const $idBtn_ColorSave = GUICtrlCreateButton("Save",8,256,75,20,-1,-1) GUICtrlSetTip(-1,"Saves and closes") GUICtrlCreateButton("Close",210,256,75,20,-1,-1) GUICtrlSetOnEvent(-1,"hWnd_Close") GUICtrlSetTip(-1,"Closes with out saving") What I'm trying to do is when tab over the 20x20 color label, to set some state to show the user that the label has focus, just like when using tab on buttons My first thought was to use buttons, but a colored button looks ugly with the 3d rounded edges, and $BS_FLAT don't work (I have read that one could use some dll kill utx theme trick) My second idea was to create buttons with images, but then I have to find a way to change the image color when the user changes the color. Cheers /Rex Link to comment Share on other sites More sharing options...
Rex Posted April 16, 2019 Author Share Posted April 16, 2019 I ended up using buttons, not as slick and pretty - but it allowed me to get on with my project, after using ½ a day to try to figure out a way to not use buttons 😕 I even tried using ListBox, but LB don't handle on event - and though I could capture the focus and even a mouse click at the LB, the capture enter key failed most of the time. Cheers /Rex 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