Jump to content

Parent restricted child GUIS


BillLuvsU
 Share

Recommended Posts

OkBasically I am trying to create a GUI, that has several other "child" windows inside it, except they are normal windows, not GUIs with the child style. Easy enough, so they can be moved around, minimized whatever. But I dont want them to be able to be dragged out the the main window. I know thats a bad explanation so i shall resort to comparisons. You know how in photoshop you can move the pallette, and layer windows around but they are stuck in the Photoshop work area? Ya, I want it to be like that. i've been trying to figure this out for about an hour and have combed the help file but found nothing. Any help would be much appreciado. Right now I'm just making it full screen so that there is nowhere else for them to be xD, but obviously I don't want it to be like that for the release. Here's the code I have so far:

#region ----------------------INCLUDES-------

#include<guiconstants.au3>

#region end ----------------------INCLUDES-------


#region --------------------------Hotkey Declaration-----

HotKeySet( "{esc}", "_close" )

#region --------------------------Hotkey Declaration-----


#region ----------------------Variable Declaration----

Dim $msg[5]
Dim $CHILD_STYLE = $WS_POPUP + $WS_CAPTION + $WS_MINIMIZEBOX + $WS_SIZEBOX 

#region end ----------------------Variable Declaration----


#region ----------------------GUI Creation------

;Create the main GUI
$GUI_main = GUICreate( "AutoIt Studio 2", @DesktopWidth, @DesktopHeight, -2, -22 );fullscreen

$menu_file = GUICtrlCreateMenu( "File" )
$menu_file_exit = GUICtrlCreateMenuItem( "Exit", $menu_file )

$menu_view = GUICtrlCreateMenu( "View" )
$menu_view_tree = GUICtrlCreateMenuItem( "Script Tree", $menu_view )
    GUICtrlSetState($menu_view_tree, $GUI_CHECKED)
$menu_view_ctrl = GUICtrlCreateMenuItem( "Controls", $menu_view )
    GUICtrlSetState($menu_view_ctrl, $GUI_CHECKED)
$infobar = GUICtrlCreateLabel( "AutoIt Studio 2.0 -", 0, @DesktopHeight - 40, @DesktopWidth, 20 );Create the information bar (bar at bottom)
    GUICtrlSetBkColor( $infobar, "0xBBBBBB" )
    GUICtrlSetColor( $infobar, "0x444444" )
GUISetState( )

;Create the treeview child GUI
$GUI_tree = GUICreate( "Script Tree", 150, 500, 0, 17, $CHILD_STYLE, -1, $GUI_main )
$tree = GUICtrlCreateTreeView( 0, 15, 150, 485 )
    $tree_include = GUICtrlCreateTreeViewItem( "Includes", $tree )
    $tree_functions = GUICtrlCreateTreeViewItem( "Functions", $tree )
    $tree_vars = GUICtrlCreateTreeViewItem( "Global Vars", $tree )
        $tree_vars_single = GUICtrlCreateTreeViewItem( "Single", $tree_vars )
        $tree_vars_array = GUICtrlCreateTreeViewItem( "Array", $tree_vars )
    $tree_guilist = GUICtrlCreateTreeViewItem( "GUIs", $tree )
GUISetState( )

;Create the function dialogue
$GUI_ctrl = GUICreate( "Controls", 150, 300, @DesktopWidth - 150, 17, $CHILD_STYLE, -1, $GUI_main )
$ctrl_list = GUICtrlCreateList( "", 0, 0, 150, 270 )
$ctrl_edit = GUICtrlCreateButton( "Edit", 10, 270, 60, 20 )
$ctrl_delete = GUICtrlCreateButton( "Delete", 80, 270, 60, 20 )
GUISetState( )

#region end ----------------------GUI Creation------


#region --------------------------Main Loop------

While 1
    
    $msg = GUIGetMsg( 1 )
    
    If $msg[0] = $menu_file_exit Then 
        _close( )
        
    ElseIf $msg[0] = $GUI_EVENT_CLOSE Then;Hides windows that close button has been clicked on
        GUISetState( @SW_HIDE, $msg[1] )
        If $msg[1] = $GUI_tree Then 
                GUICtrlSetState( $menu_view_tree, $GUI_UNCHECKED )
        ElseIf $msg[1] = $GUI_ctrl Then 
            GUICtrlSetState( $menu_view_ctrl, $GUI_UNCHECKED )
        EndIf
        
    ElseIf $msg[0] = $menu_view_tree Then;switches visibility on the tree GUI
        If BitAND( GUICtrlRead( $menu_view_tree ), $GUI_CHECKED ) = $GUI_CHECKED Then
            GUICtrlSetState( $menu_view_tree, $GUI_UNCHECKED )
            GUISetState( @SW_HIDE, $GUI_tree )
        Else
            GUICtrlSetState( $menu_view_tree, $GUI_CHECKED )
            GUISetState( @SW_SHOW, $GUI_tree )
        EndIf
        
    ElseIf $msg[0] = $menu_view_ctrl Then;switches visibility on the control GUI
        If BitAND( GUICtrlRead( $menu_view_ctrl ), $GUI_CHECKED ) = $GUI_CHECKED Then
            GUICtrlSetState( $menu_view_ctrl, $GUI_UNCHECKED )
            GUISetState( @SW_HIDE, $GUI_ctrl )
        Else
            GUICtrlSetState( $menu_view_ctrl, $GUI_CHECKED )
            GUISetState( @SW_SHOW, $GUI_ctrl )
        EndIf
        
    EndIf
    
WEnd

#region --------------------------Main Loop------


#region --------------------------Function Declaration-----

Func _close( )
    Exit
EndFunc

#region end --------------------------Function Declaration-----

Thanks in advance =]

Edit: And if anybody knows if sombody already made a UDF collection for scintilla integration with documenttion that would help alot too. I'm trying to pick apart loksters script now.

Edited by fear1313

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

You know how in photoshop you can move the pallette, and layer windows around but they are stuck in the Photoshop work area?

Hate to do this to you, but uh...

Posted Image

So your example doesn't work that well...

Are you talking about MDI windows? That's like the window that displays your image in Photoshop, but not the palette or layer windows. I got this to work to a limited degree. Example:

#include <GUIConstants.au3>

$gui = GUICreate('Hello', 400, 300)
GUISetState()

$guiC = GUICreate('Hey', 150, 150, 20, 20, BitOr($WS_CHILD, $WS_CAPTION), $WS_EX_TOOLWINDOW, $gui)
GUISetState()

While 1
    $gm = GUIGetMsg()
    Switch $gm
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

I figured it out once by goofing around (added $WS_CAPTION to a button control actually), but never dug too deep into it. Hope this is what you're looking for.

Link to comment
Share on other sites

ya thats the idea. And that gives me a clue so thanks, but my exmple does work, you just have a crappy version of photoshop xD. Also, the child looks very ugly there, and I'm very picky about looks, but thanks alot for the lead! And oh ya, I found Kips UDF set so nvm about that.

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

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...