Sign in to follow this  
Followers 0
hiimjoey11

GuiCtrlCreateDummy with Child window not working

5 posts in this topic

I am trying to understand child windows and dummy controls, and this code works great if i take out the child window code, but as soon as i want to add a child window my code breaks.  Any idea how to get around this?

#include <GUIConstantsEx.au3>

; Create parent
$hGUI = GUICreate("Parent", 100, 200)

$hButton_Child = GUICtrlCreateButton("Child", 10, 100, 80, 30)
$hButton_Test  = GUICtrlCreateButton("", 10, 50, 80, 30)
$input = GUICtrlCreateInput("", 10, 10, 80, 30)
$ButtonDummy = GUICtrlCreateDummy()
GUISetState()

; Create child
$hGUI_Child = GUICreate("Child", 200, 200)

GUISetState(@SW_HIDE)

Dim $EnterArray[1][2] = [["{ENTER}", $ButtonDummy]]
GUISetAccelerators($EnterArray)


While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_Test
            MsgBox(0, "Test", "You pressed the button!")
        Case $hButton_Child
            GUISetState($GUI_DISABLE, $hGUI)
            GUISetState(@SW_SHOW, $hGUI_Child)
            While 1

                Switch GUIGetMsg()
                    Case $GUI_EVENT_CLOSE
                        GUISetState(@SW_HIDE, $hGUI_Child)
                        GUISetState($GUI_ENABLE, $hGUI)
                        ExitLoop
                EndSwitch
            WEnd
        Case $ButtonDummy
            EnterPressed()
    EndSwitch

WEnd

Func EnterPressed()

    ;When they press Enter after typing in the coop, fill out all the buttons with the appropriate information
    $coop = GUICtrlRead($Input)
    GUICtrlSetData($hButton_Test, "TESTING")
    GUICtrlSetState($Input, $GUI_FOCUS)
EndFunc   ;==>Enter

Share this post


Link to post
Share on other sites



hiimjoey11,

Accelerator keys are linked to the last created GUI - in your code as posted that is the child. So move the GUISetAccelerators section to before the child GUI creation and all should work as you expect. ;)

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

hiimjoey11,

Accelerator keys are linked to the last created GUI - in your code as posted that is the child. So move the GUISetAccelerators section to before the child GUI creation and all should work as you expect. ;)

M23

Worked like a charm! Thanks for the quick response :D

Share this post


Link to post
Share on other sites

hiimjoey11,

Glad I could help. :)

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

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