Jump to content

Recommended Posts

Posted

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

Posted (edited)

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

hth,

whim

Edited by whim
  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:

  Reveal hidden contents

 

Posted

  On 2/12/2010 at 3:47 PM, 'Melba23 said:

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
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...