theholycow Posted September 3, 2008 Share Posted September 3, 2008 How would I go about making a given gui essentially "slide" open when a certain condition is true (in this case, when the mouse is over it, a small bar expands to a large one with buttons, etc)? I have managed to get a condition to open a new gui on top of the old one (or at whatever given position), and even close the old one, but how can I make it actually slide open? Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad... Link to comment Share on other sites More sharing options...
Champak Posted September 3, 2008 Share Posted September 3, 2008 $GUI = GUICreate("Window Slide In", 300, 300, 300, @DesktopHeight - 80) GUISetState() $WPos = WinGetPos($GUI) While 1 Sleep(100) $MPos = MouseGetPos() If ($MPos[0] >= $WPos[0]) And ($MPos[0] <= ($WPos[0] + $WPos[2])) And ($MPos[1] >= $WPos[1]) And ($MPos[1] <= ($WPos[1] + $WPos[3])) Then WinMove($GUI, "", 300, @DesktopHeight - 280, 300, 300, 3) EndIf WEnd Link to comment Share on other sites More sharing options...
theholycow Posted September 3, 2008 Author Share Posted September 3, 2008 That is perfect, thanks. Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad... Link to comment Share on other sites More sharing options...
theholycow Posted September 3, 2008 Author Share Posted September 3, 2008 ok, so now I need it to slide back when it is not moused over. I've been toying with it a few different ways, here's what I've come up with: test 1: CODE$GUI = GUICreate("Window Slide In", 300, 300, 300, @DesktopHeight - 80) GUISetState() $WPos = WinGetPos($GUI) While 1 Sleep(100) $MPos = MouseGetPos() If ($MPos[0] >= $WPos[0]) And ($MPos[0] <= ($WPos[0] + $WPos[2])) And ($MPos[1] >= $WPos[1]) And ($MPos[1] <= ($WPos[1] + $WPos[3])) Then WinMove($GUI, "", 300, @DesktopHeight - 280, 300, 300, 3) ElseIf ($MPos[0] < $WPos[0]) And ($MPos[0] > ($WPos[0] + $WPos[2])) And ($MPos[1] < $WPos[1]) And ($MPos[1] > ($WPos[1] + $WPos[3])) Then WinMove($GUI, "", 300, @DesktopHeight - 80, 300, 300, 3) EndIf WEnd test 2: CODE$GUI = GUICreate("Window Slide In", 300, 300, 300, @DesktopHeight - 80, $WS_POPUP, 0, WinGetHandle("Program Manager")) GUISetState() $WPos = WinGetPos($GUI) While 1 Sleep(100) $MPos = MouseGetPos() $msg = GUIGetMsg() Select Case ($MPos[0] >= $WPos[0]) And ($MPos[0] <= ($WPos[0] + $WPos[2])) And ($MPos[1] >= $WPos[1]) And ($MPos[1] <= ($WPos[1] + $WPos[3])) WinMove($GUI, "", 300, @DesktopHeight - 280, 300, 300, 3) Case $msg = $GUI_EVENT_CLOSE Exit Case ($MPos[0] < $WPos[0]) And ($MPos[0] > ($WPos[0] + $WPos[2])) And ($MPos[1] < $WPos[1]) And ($MPos[1] > ($WPos[1] + $WPos[3])) WinMove($GUI, "", 300, @DesktopHeight - 80, "", "", 3) EndSelect WEnd both ways it slides out fine, but won't slide back when I take the mouse away. Ideas? Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad... Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 3, 2008 Share Posted September 3, 2008 ok, so now I need it to slide back when it is not moused over. I've been toying with it a few different ways, here's what I've come up with: test 1: $GUI = GUICreate("Window Slide In", 300, 300, 300, @DesktopHeight - 80) GUISetState() $WPos = WinGetPos($GUI) While 1 Sleep(100) $MPos = MouseGetPos() If ($MPos[0] >= $WPos[0]) And ($MPos[0] <= ($WPos[0] + $WPos[2])) And ($MPos[1] >= $WPos[1]) And ($MPos[1] <= ($WPos[1] + $WPos[3])) Then WinMove($GUI, "", 300, @DesktopHeight - 280, 300, 300, 3) ElseIf ($MPos[0] < $WPos[0]) And ($MPos[0] > ($WPos[0] + $WPos[2])) And ($MPos[1] < $WPos[1]) And ($MPos[1] > ($WPos[1] + $WPos[3])) Then WinMove($GUI, "", 300, @DesktopHeight - 80, 300, 300, 3) EndIf WEnd test 2: $GUI = GUICreate("Window Slide In", 300, 300, 300, @DesktopHeight - 80, $WS_POPUP, 0, WinGetHandle("Program Manager")) GUISetState() $WPos = WinGetPos($GUI) While 1 Sleep(100) $MPos = MouseGetPos() $msg = GUIGetMsg() Select Case ($MPos[0] >= $WPos[0]) And ($MPos[0] <= ($WPos[0] + $WPos[2])) And ($MPos[1] >= $WPos[1]) And ($MPos[1] <= ($WPos[1] + $WPos[3])) WinMove($GUI, "", 300, @DesktopHeight - 280, 300, 300, 3) Case $msg = $GUI_EVENT_CLOSE Exit Case ($MPos[0] < $WPos[0]) And ($MPos[0] > ($WPos[0] + $WPos[2])) And ($MPos[1] < $WPos[1]) And ($MPos[1] > ($WPos[1] + $WPos[3])) WinMove($GUI, "", 300, @DesktopHeight - 80, "", "", 3) EndSelect WEnd both ways it slides out fine, but won't slide back when I take the mouse away. Ideas? You have AND where you want OR for the Else condition (also added an exit): $GUI = GUICreate("Window Slide In", 300, 300, 300, @DesktopHeight - 80) GUISetState() $WPos = WinGetPos($GUI) While 1 Sleep(100) $MPos = MouseGetPos() If ($MPos[0] >= $WPos[0]) And ($MPos[0] <= ($WPos[0] + $WPos[2])) And _ ($MPos[1] >= $WPos[1]) And ($MPos[1] <= ($WPos[1] + $WPos[3])) Then WinMove($GUI, "", 300, @DesktopHeight - 280, 300, 300, 3) ElseIf ($MPos[0] < $WPos[0]) Or ($MPos[0] > ($WPos[0] + $WPos[2])) Or _ ($MPos[1] < $WPos[1]) Or ($MPos[1] > ($WPos[1] + $WPos[3])) Then WinMove($GUI, "", 300, @DesktopHeight - 80, 300, 300, 3) EndIf If GUIGetMsg() = -3 Then Exit WEnd Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
theholycow Posted September 4, 2008 Author Share Posted September 4, 2008 I figured it was something small. Thanks, it works now. And here is the finished code to make it slide back in when the mouse isn't over ANY part of the window (note, I added an exit button and it is the full length of the bottom of the screen) CODE$GUI = GUICreate("Window Slide In", @DesktopWidth, 300, 0, @DesktopHeight - 80) GUISetState() $WPos = WinGetPos($GUI) $exit = GUICtrlCreateButton("X", 100, 100, 30, 15) GUICtrlSetBkColor($exit, 0xff0000) While 1 Sleep(100) $msg = GUIGetMsg() $MPos = MouseGetPos() If ($MPos[0] >= $WPos[0]) And ($MPos[0] <= ($WPos[0] + $WPos[2])) And _ ($MPos[1] >= $WPos[1]) And ($MPos[1] <= ($WPos[1] + $WPos[3])) Then WinMove($GUI, "", 0, @DesktopHeight - 280, @DesktopWidth, 300, 3) ElseIf ($MPos[0] < $WPos[0]) Or ($MPos[0] > ($WPos[0] + $WPos[2])) Or _ ($MPos[1] < ($WPos[1] - 200)) Or ($MPos[1] > ($WPos[1] + $WPos[3])) Then WinMove($GUI, "", 0, @DesktopHeight - 80, @DesktopWidth, 300, 3) ElseIf $msg = $exit Then Exit EndIf If GUIGetMsg() = -3 Then Exit WEnd Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad... 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