Sign in to follow this  
Followers 0
eJan

FileSelectFolder to follow the GUI position

4 posts in this topic

I'm using FileSelectFolder, but when I click browse button, browse dialog is positioned: X:69, Y:34, can it be set to follow GUI window or I must use default position. (I use small Browse dialog with flag set to: 0)

Script:

#include <GUIConstants.au3>

GUICreate("My GUI", 200, 100)

$btn = GUICtrlCreateButton("Browse", 75, 40, 50, 20, $WS_SYSMENU)

GUISetState(@SW_SHOW)

While 1

  $msg = GUIGetMsg()

  Select

      Case $msg = $btn

        Browse()

      Case $msg = $GUI_EVENT_CLOSE

        Exit

  EndSelect

WEnd

Func Browse()

  $open = FileSelectFolder("Select location", -1, 0, @ProgramFilesDir) ; Browse

  If @error Then

      MsgBox(4096, "", "No File(s) chosen")

  Else

      $open = StringReplace($open, "|", @CRLF)

      MsgBox(4096, "", "You chose: " & $open)

  EndIf

EndFunc

Share this post


Link to post
Share on other sites



I'm using FileSelectFolder, but when I click browse button, browse dialog is positioned: X:69, Y:34, can it be set to follow GUI window or I must use default position. (I use small Browse dialog with flag set to: 0)

Script:

<{POST_SNAPBACK}>

No, not directly with this function, would be a nice option though.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You could try WinMove() ?

Sample:

AdlibEnable('_Adlib')

Opt("WinTitleMatchMode", 2)
Func _Adlib()
    While 1
        If WinExists('AutoIt Help') Then
            $pos = WinGetPos('SciTE')
            WinActivate('AutoIt Help')
            WinMove('AutoIt Help', '', $pos[0], $pos[1])
        EndIf
    WEnd
EndFunc

Example shown, would use AdlibEnable() to check constantly, for a window title (your FileSelectFolder window), then move it, to the same co-ordinates as another window (your Gui window).

:)

Edit: FileSelectFolder() is a blocking function and AdlibEnable will pause while FileSelectFolder() is running. This idea will not work.

Edited by MHz

Share this post


Link to post
Share on other sites

Thanks bshoenhair & MHz, never mind!, I'will use it as it has to be default position.

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