MyEarth

Drag a control outside the window

7 posts in this topic

I was think if is possible in autoit drag a control outside like Window Info does for "finder tools". Yes i have see there are some script in autoit that want to "replace" info tool but is hard to understand only information about that control and most of the code is uncommented.

Thanks for suggestion or examples.

Share this post


Link to post
Share on other sites



MyEarth,

Hint: You can drag a child GUI wherever you wish.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I don't havee understood :)

Is not a kind of control? Is a child gui insde a parent gui? And after the drag return to his position? Mmm...no i don't have understood.

Share this post


Link to post
Share on other sites

MyEarth,

A bigger hint:

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

Global Const $SC_DRAGMOVE = 0xF012

$hGUI = GUICreate("Test", 500, 500)

GUISetState()

$hChild = GUICreate("", 200, 200, 100, 100, BitOr($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $hGUI)
GUISetBkColor(0xFFCCCC)
GUICtrlCreateLabel("Drag me!", 10, 10, 100, 20)
GUISetState()


While 1
    $aMsg = GUIGetMsg(1)
    Switch $aMsg[1]
        Case $hGUI

            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    Exit
            EndSwitch

        Case $hChild

            Switch $aMsg[0]
                 Case $GUI_EVENT_PRIMARYDOWN
                    _SendMessage($hChild, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)

                    $aPos = WinGetPos($hGUI)
                    WinMove($hChild, "", $aPos[0] + 100, $aPos[1] + 100)
            EndSwitch

    EndSwitch

WEnd

Do you understand now?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Melba,
Nice example
Is there a way to keep the mdi child window visible when clicking on the title bar of the parent gui ? (keep its relative z-order)

Share this post


Link to post
Share on other sites

mikell,

You could use $WS_EX_TOPMOST - or better _WinAPI_SetWindowPos to set the exact Z-order required:

$aChildPos = WinGetPos($hChild)
_WinAPI_SetWindowPos($hChild, $hGUI, $aChildPos[0], $aChildPos[1], $aChildPos[2], $aChildPos[3], $SWP_SHOWWINDOW)

While 1

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

MyEarth,

A bigger hint. Do you understand now?

M23

Yes, very near to my request, thanks! But i have a little request to your script :)

I have changed this line:

GUICtrlCreateLabel("Drag me!", 10, 10, 100, 20)
GUISetState(@SW_SHOWNOACTIVATE) ; <<< Melba look here...

Because i don't what the child steal the focus to the window, like a control. But if i drag the item and i release it, the parent lose focus so i have add this:

WinMove($hChild, "", $aPos[0] + 100, $aPos[1] + 100)
WinActivate($hGUI)  ; <<< Melba and look also here...

The problem is, the parent get the focus but if i'll try to move again the child i need to click twice, like one to give the focus and the second one to drag. If i'll try to drag at the first click nothing happens, comment out WinActivate and everything work fine but i don't have the focus on the parent. Maybe is a "false problem" and the solution is easy but trust me i'm on this from many time.

Thanks again

Edited by MyEarth

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