Jump to content

FileSelectFolder to follow the GUI position


Recommended Posts

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

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.
Link to post
Share on other sites

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
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...