sandin Posted October 31, 2008 Share Posted October 31, 2008 (edited) If you want your GUI to be small and pretty, and you don't want to make it too "crowded" with controls, simply make one button that will enable a pop-up window with the controls.expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <WinAPI.au3> Global Const $WM_ENTERSIZEMOVE = 0x0231 Global Const $WM_EXITSIZEMOVE = 0x0232 $main_height = 300 ;height of the pop-up window $slide_speed = 500 ;window pop-up/down speed, bigger number = slower, smaller number = faster $Gui = GUICreate("Test", 370, 200) ;main GUI $checkbox = GUICtrlCreateCheckbox("Disable main window when child is open", 5, 5, 250) GUICtrlSetState(-1, $GUI_CHECKED) $button1 = GUICtrlCreateButton("Child_1", 5, 160, 100, 30) $button2 = GUICtrlCreateButton("Child_2", 110, 30, 250, 20) $bb = GUICtrlCreateTab(130, 80, 200, 100) $lol = GUICtrlCreateTabItem("Random control") WinSetTrans($Gui, "", 255) ;if it's not set to 255, then sliding out has visual bugs GUISetState(@SW_SHOW, $Gui) $ParentPosArr = WinGetPos($Gui) $ChildGui = GuiCreate("Child test", 100, $main_height, $ParentPosArr[0]+$ParentPosArr[2], $ParentPosArr[1]+5,$WS_POPUP, $WS_EX_MDICHILD, $Gui) $childpos = WinGetPos($ChildGui) $label1 = GUICtrlCreateButton("Test button 1", $childpos[2]/2-45, 5, 90) GUICtrlSetResizing (-1, $GUI_DOCKWIDTH+$GUI_DOCKHCENTER) ;button will be in center, and will not change width in case of window increasement (like when u press button2) $label2 = GUICtrlCreateButton("Close", $childpos[2]/2-45, 270, 90) GUICtrlSetResizing (-1, $GUI_DOCKWIDTH+$GUI_DOCKHCENTER) $label3 = GUICtrlCreateInput("Test", $childpos[2]/2-45, 80, 90) GUICtrlCreateGraphic(0, 0, $childpos[2], $childpos[3], 0x07) ;gray line on the edge of the pop up window GUISetState(@SW_HIDE, $ChildGui) $child2 = GuiCreate("Child test", 100, $main_height, $ParentPosArr[0]+$ParentPosArr[2], $ParentPosArr[1]+5,$WS_POPUP, $WS_EX_MDICHILD, $Gui) ;transparent window to lock main window when child is opened GUISetBkColor(0, $child2) WinSetTrans($child2, "", 100) GUISetState(@SW_HIDE, $child2) GUIRegisterMsg($WM_ENTERSIZEMOVE,"WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE") Func WM_ENTERSIZEMOVE($hWndGUI, $MsgID, $WParam, $LParam) WinSetTrans($ChildGui,"",254) EndFunc Func WM_EXITSIZEMOVE($hWndGUI, $MsgID, $WParam, $LParam) WinSetTrans($ChildGui,"",255) EndFunc While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $button1 _show_child_window($button1, $slide_speed) ;slide in pop-up window ($button1 = button's handle) Case $button2 _show_child_window($button2, $slide_speed) case $label2 _slide_out($ChildGui, $slide_speed) EndSwitch WEnd Func _show_child_window($button_handle, $Speed) if WinExists($ChildGui) then _slide_out($ChildGui, $Speed/2) ;2x faster if switching between button pop-ups endif _slide_in($ChildGui, $Speed, $button_handle) EndFunc func _slide_in($hwGui, $Speed, $hwCtrl) Local $position = ControlGetPos($Gui, "", $hwCtrl) Local $position2 = WinGetPos($Gui) Local $position2b = WinGetClientSize($Gui) Local $position3 = WinGetPos($hwGui) Local $light_border = ($position2[2]-$position2b[0])/2 Local $thick_border = ($position2[3]-$position2b[1])-$light_border WinMove($hwGui, "", $position2[0]+$position[0]+$light_border, $position2[1]+$position[1]+$position[3]+$thick_border, $position[2]);set the window exacly below button DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwGui, "int", $Speed, "long", 0x00040004) _WinAPI_RedrawWindow($hwGui) GUISetState(@SW_SHOW, $hwGui) if GUICtrlRead($checkbox) = $GUI_CHECKED Then WinMove($child2, "", $position2[0]+$light_border, $position2[1]+$thick_border, $position2b[0], $position2b[1]) WinSetTrans($child2, "", 0) GUISetState(@SW_DISABLE, $child2) GUISetState(@SW_SHOWNOACTIVATE, $child2) for $i = 1 to 100 Step 10 ;showing "lock window" in smooth transparency WinSetTrans($child2, "", $i) Sleep(1) Next EndIf EndFunc func _slide_out($hwGui, $Speed) if WinExists($child2) Then for $i = 100 to 1 Step -10 WinSetTrans($child2, "", $i) Sleep(1) Next GUISetState(@SW_HIDE, $child2) EndIf DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwGui, "int", $Speed, "long", 0x00050008) GUISetState(@SW_HIDE, $hwGui) EndFuncedit: Made smoother "shadow" window appear/disappearedit2: Fixed "flash" of the child window bug Edited December 6, 2008 by sandin Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
sandin Posted October 31, 2008 Author Share Posted October 31, 2008 I can only say: This is the BEST an GUI of AutoIt, Congratulations to you thank you =D Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
sandin Posted October 31, 2008 Author Share Posted October 31, 2008 The value of $slide_speed is better: 250 $slide_speed = 250 ;window pop-up/down speed, bigger number = slower, smaller number = faster it's individual thingy, some people love when it's smoother, and some when it's faster =) In my case, I prefer 500 =) Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
gseller Posted October 31, 2008 Share Posted October 31, 2008 Totally Awesome!! Thanks for sharing! Link to comment Share on other sites More sharing options...
UltraFine Posted October 31, 2008 Share Posted October 31, 2008 Really owesome! Thanks for sharing this code, it's style is like Norton Antivirus's GUI and i think i can use it to create similar GUI's. Link to comment Share on other sites More sharing options...
sandin Posted October 31, 2008 Author Share Posted October 31, 2008 Totally Awesome!! Thanks for sharing! thank you =)Really owesome!Thanks for sharing this code, it's style is like Norton Antivirus's GUI and i think i can use it to create similar GUI's.thank you =)(I never used Norton AV, but I had problem with my GUI space, so I needed something like this, that's why I made it) Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
BrettF Posted October 31, 2008 Share Posted October 31, 2008 Very nice! Great job! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
sandin Posted October 31, 2008 Author Share Posted October 31, 2008 Very nice! Great job!tnx =D Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Calistoga Posted October 31, 2008 Share Posted October 31, 2008 This is some serious awesome work! Link to comment Share on other sites More sharing options...
sandin Posted October 31, 2008 Author Share Posted October 31, 2008 This is some serious awesome work!tnx =)btw, fixed some flash bug (which occurred when u click anywhere in child window) Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
FaT3oYCG Posted October 31, 2008 Share Posted October 31, 2008 WOW! This is great, I made a gui with a similar effect a while ago but it wasn't as smooth or beatiful as this one. Thanks for sharing it. Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right. Link to comment Share on other sites More sharing options...
sandin Posted October 31, 2008 Author Share Posted October 31, 2008 WOW!This is great, I made a gui with a similar effect a while ago but it wasn't as smooth or beatiful as this one. Thanks for sharing it.ty for the kind words =) Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
BJJ Posted February 6, 2009 Share Posted February 6, 2009 Awesome work!! Link to comment Share on other sites More sharing options...
yehia Posted February 6, 2009 Share Posted February 6, 2009 yeah totally nice i will use this My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
Rishav Posted September 1, 2009 Share Posted September 1, 2009 Fantabulous! But I have a question. Can we make the GUI of a different size slide out of the button? for eg. my button has width 100 and the gui that i want to slide out has dimensions 400*500. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now