Sign in to follow this  
Followers 0
mikelee33

2-D vs. 3-D Buttons

8 posts in this topic

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

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Function GUICtrlCreateButton: "To combine styles with the default style use BitOr($GUI_SS_DEFAULT_BUTTON, newstyle)"

hth,

whim

Edited by whim

Share this post


Link to post
Share on other sites

mikelee33 ,

No need to feel embarrassed - it took me a moment to realise why it did not work the first time I ran it! :mellow:

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._______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

...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!

:mellow:


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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

WEnd

But of course it then affects everything, including the wrapping GUI. :mellow:

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._______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

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

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