Overkill Posted February 15, 2009 Share Posted February 15, 2009 (edited) How do I get rid of the blue outer border surrounding a button? I don't want the blue killing the GUI >< Also, how can I customize the mouseover/onclick colors of the button? If I specify GUICtrlSetBkColor or GUICtrlSetColor the button loses the default mouseover properties (mouseover=gold inner border, onclick=no inner border). I tried using the style/exstyle stuff and nothing I tried worked. Created a second button so that I could tab off of my main button's focus. Example: (forgive my bored humor) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $GUI = GUICreate("This is a test GUI",300,100) GUISetBkColor(0x000000) GUICtrlCreateButton("X",0,0,1,1) GUICtrlSetBKColor(-1,0x000000) GUICtrlSetColor(-1,0x000000) $BTN = GUICtrlCreateButton("This is not a test",25,25,250,50) GUICtrlSetBKColor(-1,0x000000) GUICtrlSetColor(-1,0x00FF00) GUISetState() While 1 Switch GUIGetMsg() Case $BTN MsgBox(16,"EXPLOSION!","Told you it wasn't a test. You die in the explosion.") Case $GUI_EVENT_CLOSE MsgBox(0,"SAFE!","Congratulations: Curiosity didn't kill you...this time...") Exit EndSwitch Wend Edited February 15, 2009 by Overkill Link to comment Share on other sites More sharing options...
martin Posted February 15, 2009 Share Posted February 15, 2009 How do I get rid of the blue outer border surrounding a button? I don't want the blue killing the GUI >< Also, how can I customize the mouseover/onclick colors of the button? If I specify GUICtrlSetBkColor or GUICtrlSetColor the button loses the default mouseover properties (mouseover=gold inner border, onclick=no inner border). I tried using the style/exstyle stuff and nothing I tried worked. Created a second button so that I could tab off of my main button's focus. Example: (forgive my bored humor) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $GUI = GUICreate("This is a test GUI",300,100) GUISetBkColor(0x000000) GUICtrlCreateButton("X",0,0,1,1) GUICtrlSetBKColor(-1,0x000000) GUICtrlSetColor(-1,0x000000) $BTN = GUICtrlCreateButton("This is not a test",25,25,250,50) GUICtrlSetBKColor(-1,0x000000) GUICtrlSetColor(-1,0x00FF00) GUISetState() While 1 Switch GUIGetMsg() Case $BTN MsgBox(16,"EXPLOSION!","Told you it wasn't a test. You die in the explosion.") Case $GUI_EVENT_CLOSE MsgBox(0,"SAFE!","Congratulations: Curiosity didn't kill you...this time...") Exit EndSwitch WendTry this #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <staticconstants.au3> Global $XS_n $GUI = GUICreate("This is a test GUI",300,100) GUISetBkColor(0x000000) GUICtrlCreateButton("X",0,0,1,1) GUICtrlSetBKColor(-1,0x000000) GUICtrlSetColor(-1,0x000000) $BTN = GUICtrlCreateLabel("This is not a test",25,25,250,50, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBKColor(-1,0x000000) GUICtrlSetColor(-1,0x00FF00) GUISetState() While 1 Switch GUIGetMsg() Case $BTN MsgBox(16,"EXPLOSION!","Told you it wasn't a test. You die in the explosion.") Case $GUI_EVENT_CLOSE MsgBox(0,"SAFE!","Congratulations: Curiosity didn't kill you...this time...") Exit EndSwitch Wend Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Overkill Posted February 15, 2009 Author Share Posted February 15, 2009 That effectively achieves part of my goal, but I still want it to behave like a button (with mouseover/onclick behaviors), which is why I'm not using it. Plus, you can click on a button and it won't set GUIGetMsg() until you release the mouse button with the cursor still over it (gives you the ability to change your mind or correct a misclick). the label sends immediately on clicking, which removes this ability. It might be that the source of my problem is in the Windows XP theme, but I haven't done anything other than ponder it yet. If there's no other workaround then I suppose the label trick will have to do. Link to comment Share on other sites More sharing options...
martin Posted February 15, 2009 Share Posted February 15, 2009 That effectively achieves part of my goal, but I still want it to behave like a button (with mouseover/onclick behaviors), which is why I'm not using it. Plus, you can click on a button and it won't set GUIGetMsg() until you release the mouse button with the cursor still over it (gives you the ability to change your mind or correct a misclick). the label sends immediately on clicking, which removes this ability. It might be that the source of my problem is in the Windows XP theme, but I haven't done anything other than ponder it yet. If there's no other workaround then I suppose the label trick will have to do.The XP theme doesn't affect the blue outline. You could get the effect you want with something like this expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <staticconstants.au3> #include <misc.au3> Global $XS_n $GUI = GUICreate("This is a test GUI", 300, 100) GUISetBkColor(0x000000) GUICtrlCreateButton("X", 0, 0, 1, 1) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0x000000) $BTN = GUICtrlCreateLabel("This is not a test", 25, 25, 250, 50, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0x00FF00) GUISetState() While 1 Switch GUIGetMsg() Case $BTN GUICtrlSetBkColor($BTN, 0x111111) $over = True While _IsPressed(01) Sleep(20) $ci = GUIGetCursorInfo() If $ci[4] = $BTN And $over = False Then GUICtrlSetBkColor($BTN, 0x111111) $over = True EndIf If $ci[4] <> $BTN And $over = True Then GUICtrlSetBkColor($BTN, 0) $over = False EndIf WEnd GUICtrlSetBkColor($BTN, 0) $ci = GUIGetCursorInfo() If $ci[4] = $BTN Then MsgBox(16, "EXPLOSION!", "Told you it wasn't a test. You die in the explosion.") Case $GUI_EVENT_CLOSE MsgBox(0, "SAFE!", "Congratulations: Curiosity didn't kill you...this time...") Exit EndSwitch WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Overkill Posted February 16, 2009 Author Share Posted February 16, 2009 Worked perfectly! Thanks =) Getting the last kinks worked out of my first 'major' script...this was bugging me for a while lol. Link to comment Share on other sites More sharing options...
Comatose Posted December 17, 2018 Share Posted December 17, 2018 I had to join this forum just to say this post should be marked as solved. Without a doubt this is by far the best and most flexible approach. Also solves most every other problem (I'm looking at you focus line) ... However, I was also looking for the way to change that line color. The outline box or group box also has a color that I can't seem to change in that case white. Is there a simple way and not a total code rewrite that keys in on these lines to change their color? I can see the advantages of this approach but would also like to know if there is a solution. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 17, 2018 Developers Share Posted December 17, 2018 ... great ... but you did see the date on this post? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Comatose Posted December 17, 2018 Share Posted December 17, 2018 Great programming never dies.. Small add to this .. While(1) $overUI=(WinGetState($yourGui)) If($overUI=(15))Then ; ... mouse is over the Gui ... ... 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