Jump to content

Delete icon from button ? Please help


Recommended Posts

#include <GUIConstants.au3>

GUICreate("Test",300,300)
$Button1=GUICtrlCreateButton("Icon",10,20,35,35,$BS_ICON)
GUICtrlSetImage($button1,"shell32.dll",22)
$Button2=GUICtrlCreateButton("Reset Icon",10,80)

GUISetState()
        
while 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg=$button1
    ;Reset Icon ???? How Display Plain  Button  
        
        
        Case $Msg=$GUI_EVENT_CLOSE
        Exit    
    EndSelect
    
    
WEnd

Link to comment
Share on other sites

I assume you meant when you press button2

GUICreate("Test",300,300)
$Button1=GUICtrlCreateButton("Icon",10,20,35,35,$BS_ICON)
GUICtrlSetImage($button1,"shell32.dll",22)
$Button2=GUICtrlCreateButton("Reset Icon",10,80)

GUISetState()
        
while 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg=$button2
    ;Reset Icon ???? How Display Plain  Button 
        GuiCtrlSetState ($button1,$GUI_HIDE)
        GuiCtrlDelete($button1)
        $Button1=GUICtrlCreateButton("Icon",10,20,35,35,$BS_ICON)
        GuiCtrlSetState ($button1,$GUI_SHOW)
        Case $Msg=$GUI_EVENT_CLOSE
        Exit    
    EndSelect
    
    
WEnd
Link to comment
Share on other sites

  • Moderators

Does this work for you?

#include <GUIConstants.au3>
GUICreate("Test",300,300)
$Button1=GUICtrlCreateButton("Icon",10,20,35,35,$BS_ICON)
GUICtrlSetImage($Button1,"shell32.dll",22)
$Button2=GUICtrlCreateButton("Reset Icon",10,80)
GUISetState()
While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg=$Button1
            ;Reset Icon ???? How Display Plain  Button
            GUICtrlSetImage($Button1, 'shell32.dll', 49, $BS_ICON)
        Case $Msg=$GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

You have to tell it to do something, your only telling the Case statement to check Button1 not Button2?

Edit:

#include <GUIConstants.au3>
GUICreate("Test",300,300)
$Button1=GUICtrlCreateButton("Icon",10,20,35,35,$BS_ICON)
GUICtrlSetImage($Button1,"shell32.dll",22)
$Button2=GUICtrlCreateButton("Reset Icon",10,80)
GUISetState()
While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $Button2
            ;Reset Icon ???? How Display Plain  Button
            GUICtrlSetImage($Button1, 'shell32.dll', 49, $BS_ICON)
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
Is that what your after? Look at the $Buttons, the case checks to see if $Button2 is clicked, and then changes $Button1 Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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