Jump to content

Show/Hide button?


pintas
 Share

Recommended Posts

I have two buttons, one on top of another, and i want the pressed button to hide and to show the other.

Button one, will show some extra functions, button two, will hide them.

What is wrong with this script?

#include <misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
Opt("GUIOnEventMode", 1)

$gui =  GUICreate("  ·.·.·", 320, 120, @DesktopWidth - (320 + 12), @DesktopHeight - (120 + 53) , $WS_POPUP, $WS_EX_TOOLWINDOW)

While 1
    
$button1 = GUICtrlCreateButton("Button1", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xff0000); Red
GUICtrlSetState($Button1, $GUI_SHOW)

$button2 = GUICtrlCreateButton("Button2", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0x008000); Green
GUICtrlSetState($Button2, $GUI_HIDE)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in
WinSetOnTop( "  ·.·.·", "", 1)
TraySetState()
GUISetState()

While 1
    Switch GUICtrlRead()
        Case $button1
            GUICtrlSetState($button1, $GUI_HIDE)
            GUICtrlSetState($button2, $GUI_SHOW)
        Case $button2
            GUICtrlSetState($button1, $GUI_SHOW)
            GUICtrlSetState($button2, $GUI_HIDE)
    EndSwitch
WEnd

WEnd

Help please.

Link to comment
Share on other sites

  • Moderators

pintas,

You obviously did not bother to try and run your script before posting. If you had you would have discovered that you should be using GUIGetMsg and not GUICtrlRead in your Switch statement.

As to why it will not work once you have fixed this, AutoIt does not like overlapping active controls. It cannot tell which control is being activated (I assume it looks for mouse-click coordinates within the GUI). So your 2 buttons must be in separate places if both are active. One way I can think of that might make it work would be to ENABLE/DISABLE as well as SHOW/HIDE the buttons. Give that a try and come back if it does not work.

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

I did bother to try that, i just thought that wasn't the way to do it. I'm fairly new to Autoit.

But that doesn't solve my problem at all...

Regarding Autoit not liking overlapping, i'm sure it doesn't, but i'm also sure it's possible to do so. :)

Thanks anyway.

Anyone? Please?

Edited by pintas
Link to comment
Share on other sites

@pintas

#include <misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

$gui = GUICreate("  ·.·.·", 320, 120, @DesktopWidth - (320 + 12), @DesktopHeight - (120 + 53), $WS_POPUP, $WS_EX_TOOLWINDOW)

$button1 = GUICtrlCreateButton("Button1", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xff0000); Red
GUICtrlSetState($button1, $GUI_SHOW)

$button2 = GUICtrlCreateButton("Button2", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0x008000); Green
GUICtrlSetState($button2, $GUI_HIDE)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in
WinSetOnTop("  ·.·.·", "", 1)
TraySetState()
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            GUICtrlSetState($button1, $GUI_HIDE)
            GUICtrlSetState($button2, $GUI_SHOW)
        Case $button2
            GUICtrlSetState($button1, $GUI_SHOW)
            GUICtrlSetState($button2, $GUI_HIDE)
    EndSwitch
WEnd
Link to comment
Share on other sites

Ok, now i have another problem... :)

The animation is lost without Opt("GUIOnEventMode", 1).

#include <misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

$gui = GUICreate("  ·.·.·", 320, 120, @DesktopWidth - (320 + 12), @DesktopHeight - (120 + 53), $WS_POPUP, $WS_EX_TOOLWINDOW)

GUISetOnEvent($gui_event_close, "bye")

$button1 = GUICtrlCreateButton("Button1", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xff0000); Red
GUICtrlSetState($button1, $GUI_SHOW)

$button2 = GUICtrlCreateButton("Button2", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0x008000); Green
GUICtrlSetState($button2, $GUI_HIDE)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in
WinSetOnTop("  ·.·.·", "", 1)
TraySetState()
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            GUICtrlSetState($button1, $GUI_HIDE)
            GUICtrlSetState($button2, $GUI_SHOW)
        Case $button2
            GUICtrlSetState($button1, $GUI_SHOW)
            GUICtrlSetState($button2, $GUI_HIDE)
    EndSwitch
WEnd

Func bye(); ==>bye
    $2gui =  GUICreate("bye", 320, 30, @DesktopWidth - (320 + 12), @DesktopHeight - (30 + 175) , $WS_POPUP, $WS_EX_TOOLWINDOW)
    WinSetTrans("  ·.·.·", "", 120)
    WinSetTrans("bye", "", 220)
    GUISetBkColor(0x000000)
    _GuiRoundCorners($2gui, 0, 0, 3, 3)
    GUICtrlCreateLabel("XAU!", 150, 8, 146, 98)
    GUICtrlSetColor(-1, 0xffffff)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00040008); slide-in
    Sleep(500)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00050004)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004)
    Exit
EndFunc  ; ==>bye

Any way to fix this?

Link to comment
Share on other sites

  • Moderators

pintas,

Apologies. I could have phrased that earlier post better.

And I did not spot the Opt("GUIOnEventMode", 1) - 2 helpings of humble pie tonight!

Hope I can be of more help next time.

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

#include <misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

$gui = GUICreate("  ·.·.·", 320, 120, @DesktopWidth - (320 + 12), @DesktopHeight - (120 + 53), $WS_POPUP, $WS_EX_TOOLWINDOW)

$button1 = GUICtrlCreateButton("Button1", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xff0000); Red
GUICtrlSetState($button1, $GUI_SHOW)

$button2 = GUICtrlCreateButton("Button2", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0x008000); Green
GUICtrlSetState($button2, $GUI_HIDE)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in
WinSetOnTop("  ·.·.·", "", 1)
TraySetState()
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $button1
            GUICtrlSetState($button1, $GUI_HIDE)
            GUICtrlSetState($button2, $GUI_SHOW)
        Case $button2
            GUICtrlSetState($button1, $GUI_SHOW)
            GUICtrlSetState($button2, $GUI_HIDE)
    EndSwitch
WEnd

$2gui = GUICreate("bye", 320, 30, @DesktopWidth - (320 + 12), @DesktopHeight - (30 + 175), $WS_POPUP, $WS_EX_TOOLWINDOW)
WinSetTrans("  ·.·.·", "", 120)
WinSetTrans("bye", "", 220)
GUISetBkColor(0x000000)
;_GuiRoundCorners($2gui, 0, 0, 3, 3)
GUICtrlCreateLabel("XAU!", 150, 8, 146, 98)
GUICtrlSetColor(-1, 0xffffff)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00040008); slide-in
Sleep(500)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00050004)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004)
Exit

Link to comment
Share on other sites

I'm sorry, the function used a button to exit, i forgot to put it in the example code...

So, that doesn't work... How can use the animation?

Help please, i'm going crazy :)

#include <misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

$gui = GUICreate("  ·.·.·", 320, 120, @DesktopWidth - (320 + 12), @DesktopHeight - (120 + 53), $WS_POPUP, $WS_EX_TOOLWINDOW)

GUISetOnEvent($gui_event_close, "bye")

$button1 = GUICtrlCreateButton("Button1", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xff0000); Red
GUICtrlSetState($button1, $GUI_SHOW)

$button2 = GUICtrlCreateButton("Button2", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0x008000); Green
GUICtrlSetState($button2, $GUI_HIDE)

GUICtrlCreateButton("Exit", 185, 90, 50, 25); EXIT BUTTON BYE FUNCTION
GUICtrlSetOnEvent(-1, "bye")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xffffff)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in
WinSetOnTop("  ·.·.·", "", 1)
TraySetState()
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            GUICtrlSetState($button1, $GUI_HIDE)
            GUICtrlSetState($button2, $GUI_SHOW)
        Case $button2
            GUICtrlSetState($button1, $GUI_SHOW)
            GUICtrlSetState($button2, $GUI_HIDE)
    EndSwitch
WEnd

Func bye(); ==>bye
    $2gui =  GUICreate("bye", 320, 30, @DesktopWidth - (320 + 12), @DesktopHeight - (30 + 175) , $WS_POPUP, $WS_EX_TOOLWINDOW)
    WinSetTrans("  ·.·.·", "", 120)
    WinSetTrans("bye", "", 220)
    GUISetBkColor(0x000000)
    _GuiRoundCorners($2gui, 0, 0, 3, 3)
    GUICtrlCreateLabel("BYE!", 150, 8, 146, 98)
    GUICtrlSetColor(-1, 0xffffff)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00040008); slide-in
    Sleep(500)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00050004)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004)
    Exit
EndFunc ; ==>bye
Link to comment
Share on other sites

pintas,

Apologies. I could have phrased that earlier post better.

And I did not spot the Opt("GUIOnEventMode", 1) - 2 helpings of humble pie tonight!

Hope I can be of more help next time.

M23

No problem man. :)

But i keep bumping into errors.

This little script (1000 lines so far) i'm making is for a login screen that uses a virtual keyboard and i found a way to get that animation working without the Opt("GUIOnEventMode", 1), by naming the button and placing it inside the 'while' statement, like such:

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            GUICtrlSetState($button1, $GUI_HIDE)
            GUICtrlSetState($button2, $GUI_SHOW)
        Case $button2
            GUICtrlSetState($button1, $GUI_SHOW)
            GUICtrlSetState($button2, $GUI_HIDE)
      Case $Exit                  ;HERE
            $2gui =  GUICreate("xau", 320, 30, @DesktopWidth - (320 + 12), @DesktopHeight - (30 + 175) , $WS_POPUP, $WS_EX_TOOLWINDOW)
    WinSetTrans("  ·.·.·", "", 120)
    WinSetTrans("xau", "", 220)
    GUISetBkColor(0x000000)
    GUICtrlCreateLabel("BYE!", 150, 8, 146, 98)
    GUICtrlSetColor(-1, 0xffffff)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00040008); slide-in
    Sleep(500)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00050004)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004)
    Exit
    EndSwitch
WEnd

The problem now is that the keyboard input doesn't work at all without the Opt("GUIOnEventMode", 1). I'm using the buttons with GuiCtrlSetOnEvent and nothing happens. What can i do to solve this? Can't i use Opt("GUIOnEventMode", 1) and still use those buttons?

Btw, the show/hide button is supposed to be the shift key for the keyboard.

Link to comment
Share on other sites

@pintas

Do not mix the GUI MessageLoop Mode and the GUI OnEvent Mode

#include <misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

$gui = GUICreate("  ·.·.·", 320, 120, @DesktopWidth - (320 + 12), @DesktopHeight - (120 + 53), $WS_POPUP, $WS_EX_TOOLWINDOW)

$button1 = GUICtrlCreateButton("Button1", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xff0000); Red
GUICtrlSetState($button1, $GUI_SHOW)

$button2 = GUICtrlCreateButton("Button2", 5, 65, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0x008000); Green
GUICtrlSetState($button2, $GUI_HIDE)

$cButton_Exit = GUICtrlCreateButton("Exit", 185, 90, 50, 25); EXIT BUTTON BYE FUNCTION
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xffffff)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in
WinSetOnTop("  ·.·.·", "", 1)
TraySetState()
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $gui_event_close, $cButton_Exit
            bye()
            Exit
        Case $button1
            GUICtrlSetState($button1, $GUI_HIDE)
            GUICtrlSetState($button2, $GUI_SHOW)
        Case $button2
            GUICtrlSetState($button1, $GUI_SHOW)
            GUICtrlSetState($button2, $GUI_HIDE)
    EndSwitch
WEnd

Func bye(); ==>bye
    $2gui = GUICreate("bye", 320, 30, @DesktopWidth - (320 + 12), @DesktopHeight - (30 + 175), $WS_POPUP, $WS_EX_TOOLWINDOW)
    WinSetTrans("  ·.·.·", "", 120)
    WinSetTrans("bye", "", 220)
    GUISetBkColor(0x000000)
    ;_GuiRoundCorners($2gui, 0, 0, 3, 3)
    GUICtrlCreateLabel("BYE!", 150, 8, 146, 98)
    GUICtrlSetColor(-1, 0xffffff)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00040008); slide-in
    Sleep(500)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00050004)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004)
    Exit
EndFunc   ;==>bye
Link to comment
Share on other sites

Thank you so much Rasim. That help quite alot, but if you read my post above yours, the button input doesn't work without the Opt("GUIOnEventMode", 1).

So i'm back to square one... :)

I'm trying something like this, but with a shift key, because i'm making a full virtual keyboard for the login.

#include <md5.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("TrayMenuMode", 0)

Global $pass = "", $key = "0xc4ca4238a0b923820dcc509a6f75849b"

$gui =  GUICreate("  ·.·.·", 155, 108, @DesktopWidth - (155 + 12), @DesktopHeight - (90 + 53) , $WS_POPUP, $WS_EX_TOOLWINDOW)

$1button = GUICtrlCreateButton("1", 4, 5, 30)
GUICtrlSetOnEvent($1button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xffffff)

GUICtrlCreateButton("OK", 4, 78, 72)
GUICtrlSetOnEvent(-1, "accept")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xffffff)
GUICtrlCreateButton("CANCEL", 77, 78, 72)
GUICtrlSetOnEvent(-1, "bye")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xffffff)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in
WinSetOnTop( "  ·.·.·", "", 1)
GUISetState()
TraySetState()

Func _ButtonPress()
    $pass &= GUICtrlRead(@GUI_CtrlId)
    GUICtrlSetData($gui, GUICtrlRead($gui) & "*")
EndFunc; ==>_ButtonPress

Func bye(); ==>bye
    $2gui =  GUICreate("xau", 155, 30, @DesktopWidth - (155 + 12), @DesktopHeight - (30 + 145) , $WS_POPUP, $WS_EX_TOOLWINDOW)
    WinSetTrans("  ·.·.·", "", 120)
    WinSetTrans("bye", "", 220)
    GUISetBkColor(0x000000)
    GUICtrlCreateLabel("BYE!", 63, 8, 146, 98)
    GUICtrlSetColor(-1, 0xffffff)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00040008); slide-in
    Sleep(500)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00050004)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004)
    Exit
EndFunc  ; ==>bye

While 1
    Sleep(100)
Wend

Func accept()
    If _MD5($pass) = $key then
        $2gui =  GUICreate("right", 155, 30, @DesktopWidth - (155 + 12), @DesktopHeight - (30 + 145) , $WS_POPUP, $WS_EX_TOOLWINDOW)
        WinSetTrans("right", "", 220)
        GUISetBkColor(0x000000)
        GUICtrlCreateLabel("BEM VINDO", 48, 8, 146, 98)
        GUICtrlSetColor(-1, 0x00ff00)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00040008); slide-in
        Sleep(1000)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00050004)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004)
        GUIDelete($gui)
        GUIDelete($2gui)
    ;ENTER
        Exit
        Else
        $2gui =  GUICreate("reject", 155, 30, @DesktopWidth - (155 + 12), @DesktopHeight - (30 + 145) , $WS_POPUP, $WS_EX_TOOLWINDOW)
        WinSetTrans("  ·.·.·", "", 120)
        WinSetTrans("reject", "", 220)
        GUISetBkColor(0x000000)
        GUICtrlCreateLabel("ERRADO!", 52, 8, 146, 98)
        GUICtrlSetColor(-1, 0xff0000)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00040008); slide-in
        Sleep(1000)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00050004)
        WinSetTrans("  ·.·.·", "", 220)
        $pass = ""
    EndIf   
EndFunc
Edited by pintas
Link to comment
Share on other sites

This works fine for me.

#include <misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

Opt("GUIOnEventMode", 1)

$gui = GUICreate("  ·.·.·", 320, 120, @DesktopWidth - (320 + 12), @DesktopHeight - (120 + 53), $WS_POPUP, $WS_EX_TOOLWINDOW)

$button1 = GUICtrlCreateButton("Button1", 5, 65, 40, 20)
GUICtrlSetOnEvent(-1, "Button1")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xff0000); Red
GUICtrlSetState($button1, $GUI_SHOW)

$button2 = GUICtrlCreateButton("Button2", 5, 65, 40, 20)
GUICtrlSetOnEvent(-1, "Button2")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0x008000); Green
GUICtrlSetState($button2, $GUI_HIDE)

$cButton_Exit = GUICtrlCreateButton("Exit", 185, 90, 50, 25); EXIT BUTTON BYE FUNCTION
GUICtrlSetOnEvent(-1, "bye")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xffffff)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in
WinSetOnTop("  ·.·.·", "", 1)
TraySetState()
GUISetState()

While 1
    Sleep(100)
WEnd

Func Button1()
    GUICtrlSetState($button1, $GUI_HIDE)
    GUICtrlSetState($button2, $GUI_SHOW)
EndFunc

Func Button2()
    GUICtrlSetState($button1, $GUI_SHOW)
    GUICtrlSetState($button2, $GUI_HIDE)
EndFunc


Func bye(); ==>bye
    $2gui = GUICreate("bye", 320, 30, @DesktopWidth - (320 + 12), @DesktopHeight - (30 + 175), $WS_POPUP, $WS_EX_TOOLWINDOW)
    WinSetTrans("  ·.·.·", "", 120)
    WinSetTrans("bye", "", 220)
    GUISetBkColor(0x000000)
    ;_GuiRoundCorners($2gui, 0, 0, 3, 3)
    GUICtrlCreateLabel("BYE!", 150, 8, 146, 98)
    GUICtrlSetColor(-1, 0xffffff)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00040008); slide-in
    Sleep(500)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $2gui, "int", 200, "long", 0x00050004)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004)
    Exit
EndFunc   ;==>bye

[list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]

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