Sign in to follow this  
Followers 0
Micha1405

Delete icon from button ? Please help

9 posts in this topic

#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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

[center]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.[/center]

Share this post


Link to post
Share on other sites
:( Thanks thats it but i see the change on button when i clicked :) How to refresh ?

Share this post


Link to post
Share on other sites

:(

i click on button2 and nothing seems to happen, if i click on button 1 then icon changed to plain button

sorry for bad english :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

[center]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.[/center]

Share this post


Link to post
Share on other sites

Thanks very much ! That is what i want :)

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