Jump to content

Gui flatten buttons


 Share

Go to solution Solved by Melba23,

Recommended Posts

Hey all, I'm pretty new to AutoIt, I came from autohotkey and decided to try this and see what's better...

Now I've run into an issue while creating a gui with flatten buttons, googled it and found out the solution is

DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($button1), "wstr", 0, "wstr", 0)

But since I've like 15buttons and more coming is there a way to loop this, so I don't have to add multiple useless lines over and over?

I've tried it with an array like this

Local $ButtonList[15] = ["$Button1", "$Button2", "$Button3", "$Button4", "$Button5", "$Button6", "$Button7", "$Button8", "$Button9", "$Button10", "$Button11", "$Button12", "$Button13", "$Button14", "$Button15"]
 

But whenever I tried to call one of the buttons it wouldn't call the actual button itself...

I'm sure I'm doing something wrong however I don't know what...

Is there anyone willing to help me out a little bit on this?

Link to comment
Share on other sites

  • Moderators
  • Solution

Hawkysoft,

Welcome to the AutoIt forum. :)

You can remove the theme from the entire GUI like this:

#include <GUIConstantsEx.au3>
#include <Constants.au3>

Global $aButton[4]

DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)

$hGUI = GUICreate("Test", 500, 500)

For $i = 0 To 3
    $aButton[$i] = GUICtrlCreateButton(" Button " & $i, 10, 10 + (50 * $i), 80, 30)
Next

GUISetState()

While 1

    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $aButton[0] To $aButton[3]
            MsgBox($MB_SYSTEMMODAL, "Pressed", "Button " & $iMsg - $aButton[0])
    EndSwitch

WEnd
Or you can remove the theme from each button as you create it like this:

#include <GUIConstantsEx.au3>
#include <Constants.au3>

Global $aButton[4]

$hGUI = GUICreate("Test", 500, 500)

For $i = 0 To 3
    $aButton[$i] = GUICtrlCreateButton(" Button " & $i, 10, 10 + (50 * $i), 80, 30)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($aButton[$i]), "wstr", 0, "wstr", 0)
Next

GUISetState()

While 1

    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $aButton[0] To $aButton[3]
            MsgBox($MB_SYSTEMMODAL, "Pressed", "Button " & $iMsg - $aButton[0])
    EndSwitch

WEnd
You choose. :)

 

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:

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

 

Link to comment
Share on other sites

  • Moderators

Hawkysoft,

Glad I could help. :)

 

to get help with the basic stuff

The Help file should always be your first port of call - but do not hesitate to post even simple questions, we do not bite. Although do not be too surprised if you are redirected straight back to the Help file, but with a specific reference to a function that you missed when looking for yourself. :D

And the forum search facility (at top-right) is not the best you have ever seen, but does throw up some good leads if you use it correctly. ;)

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:

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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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