Sign in to follow this  
Followers 0
nf67

[Solved] Command to move the GUI?

3 posts in this topic

#1 ·  Posted (edited)

Hi,

I was wondering what command I can use to move my GUI, I thought it'd be GUICtrlSetPos ( Example: GUICtrlSetPos ($GUI, 500, 250) ) but that didn't work.

Next I tried GUISetCoord ( Like: GUISetCoord (500, 250) ) but I couldn't get that working either... how can I move my GUI?

Here's an example I tried to get working:

#include <ButtonConstants.au3>
  #include <GUIConstantsEx.au3>
  #include <WindowsConstants.au3>
  
  $Hori = 300
  $Vert = 300
  $GUI = GUICreate("GUI", 154, 102, $Hori, $Vert)
  $RightButton = GUICtrlCreateButton("Right", 72, 32, 73, 33, $WS_GROUP)
  $LeftButton = GUICtrlCreateButton("Left", 8, 32, 65, 33, $WS_GROUP)
  GUISetState(@SW_SHOW)
  
  
  While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
          
      Case $GUI_EVENT_CLOSE
          Exit
          
      Case $RightButton
          $Hori = $Hori + 50
          GUICtrlSetPos ($GUI, $Hori, $Vert); - OR -   GUISetCoord ($Hori, $Vert) 
          
      Case $LeftButton
          $Hori = $Hori - 50
          GUICtrlSetPos ($GUI, $Hori, $Vert); - OR -  GUISetCoord ($Hori, $Vert)
          
      EndSwitch
  WEnd

Thanks :)

Edited by nf67

Share this post


Link to post
Share on other sites



Hi,

I was wondering what command I can use to move my GUI, I thought it'd be GUICtrlSetPos ( Example: GUICtrlSetPos ($GUI, 500, 250) ) but that didn't work.

Next I tried GUISetCoord ( Like: GUISetCoord (500, 250) ) but I couldn't get that working either... how can I move my GUI?

Here's an example I tried to get working:

#include <ButtonConstants.au3>
 #include <GUIConstantsEx.au3>
 #include <WindowsConstants.au3>
 
 $Hori = 300
 $Vert = 300
 $GUI = GUICreate("GUI", 154, 102, $Hori, $Vert)
 $RightButton = GUICtrlCreateButton("Right", 72, 32, 73, 33, $WS_GROUP)
 $LeftButton = GUICtrlCreateButton("Left", 8, 32, 65, 33, $WS_GROUP)
 GUISetState(@SW_SHOW)
 
 
 While 1
     $nMsg = GUIGetMsg()
     Switch $nMsg
         
     Case $GUI_EVENT_CLOSE
         Exit
         
     Case $RightButton
         $Hori = $Hori + 50
         GUICtrlSetPos ($GUI, $Hori, $Vert); - OR -   GUISetCoord ($Hori, $Vert) 
         
     Case $LeftButton
         $Hori = $Hori - 50
         GUICtrlSetPos ($GUI, $Hori, $Vert); - OR -  GUISetCoord ($Hori, $Vert)
         
     EndSwitch
 WEnd

Thanks :)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Hori = 300
$Vert = 300
$GUI = GUICreate("GUI", 154, 102, $Hori, $Vert)
$RightButton = GUICtrlCreateButton("Right", 72, 32, 73, 33, $WS_GROUP)
$LeftButton = GUICtrlCreateButton("Left", 8, 32, 65, 33, $WS_GROUP)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        
    Case $GUI_EVENT_CLOSE
        Exit
        
    Case $RightButton
        $Hori = $Hori + 50
        WinMove($GUI, '', $Hori, $Vert)
;        GUICtrlSetPos ($GUI, $Hori, $Vert); - OR -   GUISetCoord ($Hori, $Vert)
        
    Case $LeftButton
        $Hori = $Hori - 50
        WinMove($GUI, '', $Hori, $Vert)
;        GUICtrlSetPos ($GUI, $Hori, $Vert); - OR -  GUISetCoord ($Hori, $Vert)
        
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Thanks a lot :)

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