Sign in to follow this  
Followers 0

child GUI boundries inside parent?

3 posts in this topic


my problem/question is, can i have a child GUI that cannot be dragged out of its parent? or is there a setting for this?

so far i have this code (images attached if you'd like:

$MAINGUI = GUICreate("Coins", 600, 400)
$FILEMENU = GUICtrlCreateMenu("File")
$FILEMENUSECT1 = GUICtrlCreateMenuItem("Open player...", $FILEMENU)
$FILEMENUSECT2 = GUICtrlCreateMenuItem("Save player...", $FILEMENU)
$FILEMENUSECT3 = GUICtrlCreateMenuItem("Save", $FILEMENU)
GUICtrlCreateMenuItem("", $FILEMENU)
$FILEMENUSECT4 = GUICtrlCreateMenuItem("Exit", $FILEMENU)
GUICtrlCreatePic("backround.jpg", 0, 0, 600, 380) 
GUICtrlSetState(-1, $GUI_DISABLE)

$DIMEWIN = GUICreate("", 40, 40, 20, 20, $WS_POPUP, BitOr($WS_EX_LAYERED, $WS_EX_MDICHILD), $MAINGUI)
$DIME = GUICtrlCreatePic("dime.gif", 0, 0, 40, 40)
While 1
    $GET = GUIGetMsg()
    If $GET = $GUI_EVENT_CLOSE Then Exit
    If $GET = $FILEMENUSECT4 Then Exit
    If $GET = $DIME Then Drag($DIMEWIN)
Func Drag($WIN)
        $MOUSEPOS = MouseGetPos()
        WinMove($WIN, "", $MOUSEPOS[0], $MOUSEPOS[1])
    Until _IsPressed(01) = 0

and when you Drag the dime, the child window can be dragged anywhere evn outside of the parent, i don't want this, i need a way to only allow it to be dragged inside the parent GUI

any ideas ?




Share this post

Link to post
Share on other sites

#3 ·  Posted (edited)

thanks Uten, exactly what i was looking for

edit i dont really have time to look in depth at the code now but it doesnt seem that you can use this script for two GUI's running in one script, does anyone know ? again i'll look more at it when i get back

Edited by layer


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