Jump to content

child GUI boundries inside parent?


layer
 Share

Recommended Posts

hi,

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)
GUISetState(@SW_SHOW, $MAINGUI)
;
;

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

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 ?

thanks

post-3648-1159998689_thumb.jpg

FootbaG
Link to comment
Share on other sites

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
FootbaG
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...