Class
MDIWindow
Description
Used to configure the MDI window on Multiple Document Interface applications. Specify the Multiple Document Interface option in the Properties pane for the App class.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
✓ |
|||
Property descriptions
MDIWindow.Handle
Handle As Integer
Returns a handle to the MDI window. Any visible Win32 control should have a handle.
This property is read-only.
MDIWindow.Height
Height As Integer
The height of the MDI window.
This example sets several properties of the MDIWindow. It is in the Open event of the app.
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600
app.MDIWindow.Visible=True
MDIWindow.Left
Left As Integer
The distance (in pixels) between the left edge of the screen and the left edge of the MDI window.
This example sets several properties of the MDIWindow. It is in the Open event of the app.
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600
app.MDIWindow.Visible=True
MDIWindow.MaxHeight
MaxHeight As Integer
The maximum height to which the MDI window can be resized.
This example sets several properties of the MDIWindow. It is in the Open event of the app.
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600
app.MDIWindow.Visible=True
MDIWindow.MaxWidth
MaxWidth As Integer
The maximum width to which the MDI window can be resized.
This example sets several properties of the MDIWindow. It is in the Open event of the app.
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600
app.MDIWindow.Visible=True
MDIWindow.MinHeight
MinHeight As Integer
The minimum height to which the MDI window can be resized.
This example sets several properties of the MDIWindow. It is in the Open event of the app.
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600
app.MDIWindow.Visible=True
MDIWindow.MinWidth
MinWidth As Integer
The minimum width to which the MDI window can be resized.
This example sets several properties of the MDIWindow. It is in the Open event of the app.
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600
app.MDIWindow.Visible=True
MDIWindow.Title
Title As String
The MDI window title.
This example sets several properties of the MDIWindow. It is in the Open event of the app.
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600
app.MDIWindow.Visible=True
MDIWindow.Top
Top As Integer
The distance (in pixels) between the top edge of the screen and the top edge of the MDI window.
This example sets several properties of the MDIWindow. It is in the Open event of the app.
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600
app.MDIWindow.Visible=True
MDIWindow.Visible
Visible As Boolean
If True, the MDI window will be visible when it is opened.
This example sets several properties of the MDIWindow. It is in the Open event of the app.
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600
app.MDIWindow.Visible=True
MDIWindow.Width
Width As Integer
The width of the MDI window.
This example sets several properties of the MDIWindow. It is in the Open event of the app.
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600
app.MDIWindow.Visible=True
Method descriptions
MDIWindow.Maximize
Maximize
Maximizes the MDI window.
This example maximizes the MDI window.
app.MDIWindow.Maximize
MDIWindow.Minimize
Minimize
Minimizes the MDI window.
This example minimizes the MDI window.
app.MDIWindow.Minimize
MDIWindow.Restore
Restore
Restores the MDI window.
Event descriptions
MDIWindow.Moved
Moved
Occurs when the MDI window moves.
MDIWindow.Open
Open
Occurs when the MDI window is created.
MDIWindow.Resized
Resized
Occurs when the MDI window resizes.
MDIWindow.Restore
Restore
Occurs when the MDI window is restored to its former size.
Notes
You have the option of using the Multiple Document Interface (MDI) for the Windows build of your application. If you select this option, all of your application's windows will be enclosed in a "parent" window called the MDI window. If you don't select the MDI interface, then your application will be a Single Document Interface (SDI) application and your application's windows will be directly on the desktop (since there is no MDI window). This class allows you to set certain properties and behaviors of the MDI window.
You can set the MDIWindow property of the App class to a new instance of an MDIWindow subclass. Use this technique to implement the events for an MDIWindow.
Getting the handle of a child window
There are two handles that a Declare writer may need when it comes to MDIWindows. The Handle property returns the frame window's handle. If you want the MDICLIENT handle for doing things like cascading child windows, then you need to get the child window based on the Handle with a code snippet like this:
Module MDIWindowExtensions
Private Var mClientHandle As Integer
Function MDIClientHandle(Extends w As MDIWindow) As Integer
' There's two different handles used for an MDI window. The frame
' handle (which is MDIWindow.Handle), and the client handle. This
' gets the client handle, which is used for things like tiling or cascading
' child windows.
If mClientHandle <> 0 Then Return mClientHandle
#If TargetWindows
Declare Sub EnumChildWindows Lib "User32" ( parent As Integer, _
proc As Ptr, lParam As Integer )
mClientHandle = 0
' Do the enumeration
EnumChildWindows(w.Handle, AddressOf enumChildProc, 0)
' Return the client's handle
Return mClientHandle
#Endif
End Function
Function EnumChildProc(hwnd As Integer, lParam As Integer) As Boolean
#If TargetWindows Then
' We need to figure out what class this window belongs to
Soft Declare Function GetClassNameW Lib "User32" (hwnd As Integer,_
name As Ptr, count As Integer) As Integer
Soft Declare Function GetClassNameA Lib "User32" (hwnd As Integer, _
name As Ptr, count As Integer) As Integer
Var classNamePtr As New MemoryBlock(256)
Var className As String
If System.IsFunctionAvailable("GetClassNameW", "User32") Then
Var cnt As Integer = GetClassNameW(hwnd, classNamePtr, classNamePtr.Size)
className = classNamePtr.WString(0)
Else
Var cnt As Integer = GetClassNameW(hwnd, classNamePtr, classNamePtr.Size)
className = classNamePtr.CString(0)
End If
' If the name is MDICLIENT, then we're done
If className = "MDICLIENT" Then
mClientHandle = hwnd
Return False
End If
Return True
#Endif
End Function
End Module
Sample code
This example sets several properties of the MDIWindow. It is in the Open event of the app.
App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinWidth = 250
App.MDIWindow.MinHeight = 100
App.MDIWindow.MaxHeight = 400
App.MDIWindow.MaxWidth = 600
App.MDIWindow.Visible = True
Compatibility
All project types on all supported operating systems.
See also
Object parent class; DesktopApplication class; App object.