Jump to content
Sign in to follow this  
Particle

MDI Question

Recommended Posts

Particle

I'm currently working on a small experimental scanner and when I use MDI(for those who don't know it's Multiple Document Interface), the Parent GUI's menu won't respond as if the GUI is inactive. Is there a way to fix this so I can allow the user to access the menu while accessing all Child GUIs?

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <IE.au3>
#include <Array.au3>
#Include <GuiMenu.au3>
#include <File.au3>
#Include <GuiListView.au3>
#include <GuiIPAddress.au3>
$AdvancedMode = GUICreate("Scanner", 633, 451, -1, -1)
$MenuItem1 = GUICtrlCreateMenu("&File")
$MenuItem2 = GUICtrlCreateMenuItem("Start", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Disconnect", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Clear", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("Export List", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenuItem("Exit  Program", $MenuItem1)
$MenuItem7 = GUICtrlCreateMenu("&Tools")
$MenuItem8 = GUICtrlCreateMenuItem("Advanced Options", $MenuItem7)
$MenuItem9 = GUICtrlCreateMenuItem("Check for Updates", $MenuItem7)
$MenuItem10 = GUICtrlCreateMenu("Select Mode", $MenuItem7)
$MenuItem11 = GUICtrlCreateMenuItem("Standard", $MenuItem10)
$MenuItem12 = GUICtrlCreateMenuItem("Advanced ·", $MenuItem10)
$MenuItem18 = GUICtrlCreateMenuItem("View Scan List", $MenuItem7)
$MenuItem13 = GUICtrlCreateMenu("&Extra")
$MenuItem14 = GUICtrlCreateMenuItem("About", $MenuItem13)
$MenuItem15 = GUICtrlCreateMenuItem("Credits", $MenuItem13)
$MenuItem16 = GUICtrlCreateMenu("Plugins", $MenuItem13)
$MenuItem17 = GUICtrlCreateMenuItem("...", $MenuItem16)
GUISetState(@SW_SHOW,$AdvancedMode)

$SGUI = GUICreate("Spawn 1", 200, 50, 5, 5, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE),$WS_OVERLAPPED)
DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($SGUI), "hwnd", WinGetHandle($AdvancedMode))  
GUISetState(@SW_SHOW,$SGUI)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            If WinActive($SGUI) = 1 Then
                GUIDelete($SGUI)
            ElseIf WinActive($AdvancedMode) = 1 Then
                Exit
            EndIf
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
Melba23

Particle,

I must admit that I find the combination of GUI styles a bit confusing at times, but this is one that I have used frequently and I think it might be what you want:

$SGUI = GUICreate("Spawn 1", 200, 50, 25, 55, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_MDICHILD), $AdvancedMode) 
GUISetState(@SW_SHOW,$SGUI)
WinSetTrans($SGUI, "", 250)

If it is not - tell me and I will have another go!

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
Particle

Well it did work, but then when I switched to my other GUI for Standard Mode the Child should automatically hide when u @SW_HIDE the Parent don't you think? It didn't seem to do that, but if there is no other way I can still deal with it, only a few extra lines.

Share this post


Link to post
Share on other sites
Melba23

Particle,

Glad I got you part of the way there! :-)

On a different point, I have only just noticed your GUIGetMsg() loop. Are you aware of the advanced parameter for the function? It returns an array which gives you the window it came from as well as the ControlID. You might find it easier than using If WinActive.

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
GEOSoft

Particle,

Glad I got you part of the way there! :-)

On a different point, I have only just noticed your GUIGetMsg() loop. Are you aware of the advanced parameter for the function? It returns an array which gives you the window it came from as well as the ControlID. You might find it easier than using If WinActive.

M23

Actually at first glance I think there is something wrong in the code you posted. Give me a minute and I'll come back and edit this post.

EDIT: Still can't spot it so I guess I was wrong. That happended once before too, being wrong that is.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Melba23

GEOSoft,

Would not be the first time my code is "less than optimal"! :-)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.