Jump to content

Button icon problem


JRowe
 Share

Recommended Posts

I have a button, which on loading appears perfectly fine.

After clicking on the Play button, nothing changes, so it's not a universal GUI event. After clicking the Stop button, however, the button frame appears, and won't go away. The search terms turn up a million unrelated things, so I thought I'd ask. Anyone know what causes this problem?

$Button1 = GUICtrlCreateButton("", 152, 69, 32, 32, BitOR($BS_DEFPUSHBUTTON,$BS_PUSHBOX,$BS_FLAT,$BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "buttons.dll", -8)
GUICtrlSetTip(-1, "Start")
$Button2 = GUICtrlCreateButton("", 272, 69, 75, 33, BitOR($BS_PUSHBOX,$BS_FLAT,$BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "buttons.dll", -12)
GUICtrlSetTip(-1, "Stop")

$Button2 is displaying the undesired behavior. I simply want the icon as a button without the frame.

Edited by JRowe
Link to comment
Share on other sites

I know that I can create a picture that acts like a button. I'm asking how to make the button work correctly.

Link to comment
Share on other sites

I'm not gonna buy that buttons don't work. Some sort of style message can be sent.

_GUICtrlButton_SetStyle($Button1, BitOR($BS_ICON,$BS_PUSHBOX, $BS_FLAT, $WS_GROUP))

Like that, or some other method.

#Include <GuiButton.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

GUICreate("Test GUI", 200, 200)  ; will create a dialog box that when displayed is centered

$Button1 = GUICtrlCreateButton("Test Button", 50, 50, 32, 32, BitOR($BS_ICON,$BS_PUSHBOX, $BS_FLAT, $WS_GROUP))
GUICtrlSetImage(-1, "shell32.dll", -12)
GUISetState()
_GUICtrlButton_SetState($Button1, False)
While 1
    Switch GUIGetMsg()

        Case $GUI_EVENT_CLOSE
            GUIDelete();
            Exit

            Case $Button1
            _GUICtrlButton_SetStyle($Button1, BitOR($BS_ICON,$BS_PUSHBOX, $BS_FLAT, $WS_GROUP))
            _GUICtrlButton_SetState($Button1, False)
    EndSwitch
WEnd
Link to comment
Share on other sites

Alright, along with the no-dotted focus lines UDF, I was able to do this:

#Include <GuiButton.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
;#include <noFocus.au3>
;_NoFocusLines_Global()
GUICreate("Test GUI", 200, 200)  ; will create a dialog box that when displayed is centered

$Button1 = GUICtrlCreateButton("", 50, 50, 32, 32, bitor($BS_ICON, $BS_PUSHBOX))
GUICtrlSetImage(-1, "shell32.dll", -12)
GUISetState()


While 1
    Switch GUIGetMsg()

        Case $GUI_EVENT_CLOSE
            GUIDelete();
            ;DllCallBackFree($hNoFocusLines_Proc)
            Exit

            Case $Button1
            _GUICtrlButton_SetStyle($Button1, BitOR($BS_ICON,$BS_PUSHBOX))
    EndSwitch
WEnd

Uncomment if you have the noFocus udf, otherwise, imagine it without the dotted focus lines.

Thank you, though,Yashied.

Edited by JRowe
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...