The_Noob Posted September 25, 2006 Posted September 25, 2006 (edited) Ok im not totally competant with GUI's, what do i need to add so that when a user clicks the red X that normally closes windows to close the GUI. Its not doing it for mine... #include <GUIConstants.au3> sleep(1000) WinSetOnTop("window", "", 0) GUICreate("Move",1030,791) GUISetState (@SW_SHOW) $lastpos = WinGetPos ( "Move" ) $pos = WinGetPos ( "Move" ) winactivate("window") do $lastpos[0] = $pos[0] $lastpos[1] = $pos[1] $lastpos[2] = $pos[2] $lastpos[3] = $pos[3] $pos = WinGetPos ( "Move" ) WinMove ( "window", "", $pos[0]+3, $pos[1]+29, $pos[2]-6 , $pos[3]-32 ) if wingetstate("Move") = 15 then winactivate("window") endif sleep(50) until 1 = 2 There it is... basically im using the GUI as a frame for another window, but i want it so that when i click the X it closes the "frame". Also, how do i make the GUI resizeable? Edited September 25, 2006 by The_Noob
Valuater Posted September 25, 2006 Posted September 25, 2006 no sleep needed with GUIGetMsg() #include <GUIConstants.au3> Sleep(1000) WinSetOnTop("window", "", 0) GUICreate("Move", 1030, 791) GUISetState(@SW_SHOW) $lastpos = WinGetPos("Move") $pos = WinGetPos("Move") WinActivate("window") Do $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit $lastpos[0] = $pos[0] $lastpos[1] = $pos[1] $lastpos[2] = $pos[2] $lastpos[3] = $pos[3] $pos = WinGetPos("Move") WinMove("window", "", $pos[0] + 3, $pos[1] + 29, $pos[2] - 6, $pos[3] - 32) If WinGetState("Move") = 15 Then WinActivate("window") EndIf Until 1 = 2 8)
The_Noob Posted September 25, 2006 Author Posted September 25, 2006 (edited) so what does GUIGetMsg() do? Im assuming it reads the GUI, and if a button is pressed, like the "big red x" then it can react... Edited September 25, 2006 by The_Noob
jinxter Posted September 25, 2006 Posted September 25, 2006 (edited) I would use While/Wend instead... (not that it matters, but I like it ) Do a select Case for each button or function in the application, $msg is the actual return from the windowbox. Try to search the AutoIT manual for GUIGetMsg()... it will tell you how it all works, and more. #include <GUIConstants.au3> sleep(1000) WinSetOnTop("window", "", 0) GUICreate("Move",1030,791) GUISetState (@SW_SHOW) $lastpos = WinGetPos ( "Move" ) $pos = WinGetPos ( "Move" ) winactivate("window") GUISetState() While 1 $lastpos[0] = $pos[0] $lastpos[1] = $pos[1] $lastpos[2] = $pos[2] $lastpos[3] = $pos[3] $pos = WinGetPos ( "Move" ) WinMove ( "window", "", $pos[0]+3, $pos[1]+29, $pos[2]-6 , $pos[3]-32 ) if wingetstate("Move") = 15 then winactivate("window") endif $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ; Exitbutton ExitLoop Case Else ; enter other code here EndSelect sleep(50) WEnd damn... second, 1-1 eh valuater? Edited September 25, 2006 by jinxter > there are 10 types of people in the world, those who understand binary and those who don't.
Valuater Posted September 25, 2006 Posted September 25, 2006 I would use While/Wend instead... (not that it matters, but I like it )Do a select Case for each button or function in the application, $msg is the actual return from the windowbox.Try to search the AutoIT manual for GUIGetMsg()... it will tell you how it all works, and more.damn... second, 1-1 eh valuater?yea... but your script has better direction8)
The_Noob Posted September 25, 2006 Author Posted September 25, 2006 Ok what about the 2nd part of my question... how do i make the GUI wondow resizeable?
jinxter Posted September 25, 2006 Posted September 25, 2006 (edited) maybe.... GUICreate("Move",1030,791,-1,-1,$WS_SIZEBOX) of course it can be handled in a much better way.... as described in the manual under GUICreate and the GUI Control Styles Appendix. Edited September 25, 2006 by jinxter > there are 10 types of people in the world, those who understand binary and those who don't.
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