mikelee33 Posted February 12, 2010 Posted February 12, 2010 I'm a bit embarrassed to have to ask, but for some reason I can't get 2-D buttons to work. All other push button styles work, just not 2-D. $button1 = GUICtrlCreateButton ("Button1", 560, 165, 77, 20, $BS_FLAT) I include GUIConstants and ButtonConstants (I'm still with 3.2.10). Ideas? Many Thanks
FinalVersion Posted February 12, 2010 Posted February 12, 2010 (edited) Use Koda to make GUI's, makes life easier.Get Koda Here Edited February 12, 2010 by FinalVersion [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center]
whim Posted February 12, 2010 Posted February 12, 2010 (edited) Function GUICtrlCreateButton: "To combine styles with the default style use BitOr($GUI_SS_DEFAULT_BUTTON, newstyle)"hth,whim Edited February 12, 2010 by whim
Moderators Melba23 Posted February 12, 2010 Moderators Posted February 12, 2010 mikelee33 , No need to feel embarrassed - it took me a moment to realise why it did not work the first time I ran it! Certain styles require you to remove the XP/Vista/Win 7 theme from the control. Try running this: #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> $hGUI = GUICreate("Test", 500, 500) $hButton = GUICtrlCreateButton ("Button", 10, 10, 80, 30) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hButton), "wstr", 0, "wstr", 0) GUICtrlSetStyle($hButton, $BS_FLAT) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton ConsoleWrite("Hit" & @CRLF) EndSwitch WEnd M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
PsaltyDS Posted February 12, 2010 Posted February 12, 2010 ...and I didn't realize you could do that to an individual control. Got me some edumacation. I used to couldn't spell poorgrammer, now I are one thanks to Melba23! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
mikelee33 Posted February 12, 2010 Author Posted February 12, 2010 No need to feel embarrassed - it took me a moment to realise why it did not work the first time I ran it!Thanks, that sure makes me feel better, and it does indeed work. Interesting how after two years of using AutoIt I just now ran into this issue (having never needed 2-D buttons before). It does seem a little involved to accomplish 2-D, but not unreasonably so.Again, Many thanks.
Moderators Melba23 Posted February 12, 2010 Moderators Posted February 12, 2010 mikelee33,You can also turn off the theme for the whole GUI like this (which I think is what PsaltyDS was thinking of):#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) $hGUI = GUICreate("Test", 500, 500) $hButton = GUICtrlCreateButton("Button", 10, 10, 80, 30, $BS_FLAT) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton ConsoleWrite("Hit" & @CRLF) EndSwitch WEndBut of course it then affects everything, including the wrapping GUI. Incidentally, if you remove the theme you can colour groups, radios and checkboxes using GUICtrlSetColor/BkColor - and not a lot of people know that! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
mikelee33 Posted February 12, 2010 Author Posted February 12, 2010 This is all news to me. Thank you for the extra tips. I am sure I will use them in my apps. I'm excited about the flexibility this will bring. Mike
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