Sign in to follow this  
Followers 0
momar33

Maximized child window overlapping tool bar

7 posts in this topic

When i maximize my child window it overlaps my tool bar. Anyone know how to make the child window maximize beneath the toolbar?

Is there a way to see the GUICtrlCreateMenu functions code, because the menu doesn't get overlapped.

Any help is appreciated.

Thanks.

Here is code demonstrating my problem:

CODE
#include <GUIConstants.au3>

;#include <database.au3>

#include <A3LToolbar.au3>

Global Enum $idNew=1000, $idOpen, $idSave, $idHelp

; Script Start - Add your code below here

$main = GUICreate("Spell Inventory", 800, 500, -1,-1, $WS_OVERLAPPEDWINDOW)

GUISetState ()

$dbname = "C:\Documents and Settings\sjraisbe\Desktop\SI\database.mdb"

$tblname = "Spells"

$fldname = "Spell"

;MI = menu item

;-----File Menu-----

$fileMenu = GuiCtrlCreateMenu ("File")

$importMI = GuiCtrlCreateMenuitem ("Import File",$filemenu)

$separator = GuiCtrlCreateMenuitem ("",$filemenu)

$ppOptionsMenu = GuiCtrlCreateMenu ("Print Preview Options",$filemenu)

$separator = GuiCtrlCreateMenuitem ("",$filemenu)

$exitMI = GuiCtrlCreateMenuitem ("Exit",$filemenu)

;-----Tools Menu-----

$toolsMenu = GuiCtrlCreateMenu ("Tools")

$manageSpellbooksMI = GuiCtrlCreateMenuitem ("Manage Spellbooks",$toolsMenu)

$manageSchoolsMI = GuiCtrlCreateMenuitem ("Manage Schools",$toolsMenu)

$manageSpellsMI = GuiCtrlCreateMenuitem ("Manage Spells",$toolsMenu)

$separator = GuiCtrlCreateMenuitem ("",$toolsMenu)

$manageScrollsMI = GuiCtrlCreateMenuitem ("Manage Scrolls",$toolsMenu)

$separator = GuiCtrlCreateMenuitem ("",$toolsMenu)

$searchMI = GuiCtrlCreateMenuitem ("Search",$toolsMenu)

;-----Window Menu-----

$windowMenu = GuiCtrlCreateMenu ("Window")

$tileMI = GuiCtrlCreateMenuitem ("Tile",$windowMenu)

$separator = GuiCtrlCreateMenuitem ("",$windowMenu)

$cascadeMI = GuiCtrlCreateMenuitem ("Cascade",$windowMenu)

;-----About Menu-----

$aboutMenu = GuiCtrlCreateMenu ("About")

$helpTopicsMI = GuiCtrlCreateMenuitem ("Help Topics",$aboutMenu)

$separator = GuiCtrlCreateMenuitem ("",$aboutMenu)

$aboutMI = GuiCtrlCreateMenuitem ("About SI",$aboutMenu)

$hToolbar = _Toolbar_Create($main)

; Add standard system bitmaps

_Toolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons

_Toolbar_AddButton ($hToolbar, $idNew , $STD_FILENEW )

_Toolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)

_Toolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)

_Toolbar_AddButtonSep($hToolbar)

_Toolbar_AddButton ($hToolbar, $idHelp, $STD_HELP )

;$viewSpell = GUICtrlCreateButton ("1", 0,0,30,30,$BS_ICON)

;GUICtrlSetImage (-1, "shell32.dll",134)

$child = GUICreate("View Spells", 200, 200, 40, 0, $WS_OVERLAPPEDWINDOW)

DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($child), "hwnd", WinGetHandle($main))

GUISetState ()

do

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $exitMI

ExitLoop

Case $msg = $aboutMI

Msgbox(0,"About","Spell Inventory")

EndSelect

until $msg = $GUI_EVENT_CLOSE

GUIDelete()

Exit

Share this post


Link to post
Share on other sites



Ok, i have figured out a way to make the child window to maximize below the tool bar....but it has problems.

What i do is create a child gui for the tool bar and then create another child gui for the main window.

The problem is that these 2 child guis do not change in size when the parent window is resized or maximized.

This isn't too big of a problem for the tool bar, i can just make it really long, it is however needed for the other child gui.

Does anybody know a way to make child gui dynamic?

Here is the code:

CODE
#include <GUIConstants.au3>

;#include <database.au3>

#include <A3LToolbar.au3>

Global Enum $idNew=1000, $idOpen, $idSave, $idHelp

; Script Start - Add your code below here

$main = GUICreate("Spell Inventory", 800, 500, -1,-1, $WS_OVERLAPPEDWINDOW)

GUISetState ()

$dbname = "C:\Documents and Settings\sjraisbe\Desktop\SI\database.mdb"

$tblname = "Spells"

$fldname = "Spell"

;MI = menu item

;-----File Menu-----

$fileMenu = GuiCtrlCreateMenu ("File")

$importMI = GuiCtrlCreateMenuitem ("Import File",$filemenu)

$separator = GuiCtrlCreateMenuitem ("",$filemenu)

$ppOptionsMenu = GuiCtrlCreateMenu ("Print Preview Options",$filemenu)

$separator = GuiCtrlCreateMenuitem ("",$filemenu)

$exitMI = GuiCtrlCreateMenuitem ("Exit",$filemenu)

;-----Tools Menu-----

$toolsMenu = GuiCtrlCreateMenu ("Tools")

$manageSpellbooksMI = GuiCtrlCreateMenuitem ("Manage Spellbooks",$toolsMenu)

$manageSchoolsMI = GuiCtrlCreateMenuitem ("Manage Schools",$toolsMenu)

$manageSpellsMI = GuiCtrlCreateMenuitem ("Manage Spells",$toolsMenu)

$separator = GuiCtrlCreateMenuitem ("",$toolsMenu)

$manageScrollsMI = GuiCtrlCreateMenuitem ("Manage Scrolls",$toolsMenu)

$separator = GuiCtrlCreateMenuitem ("",$toolsMenu)

$searchMI = GuiCtrlCreateMenuitem ("Search",$toolsMenu)

;-----Window Menu-----

$windowMenu = GuiCtrlCreateMenu ("Window")

$tileMI = GuiCtrlCreateMenuitem ("Tile",$windowMenu)

$separator = GuiCtrlCreateMenuitem ("",$windowMenu)

$cascadeMI = GuiCtrlCreateMenuitem ("Cascade",$windowMenu)

;-----About Menu-----

$aboutMenu = GuiCtrlCreateMenu ("About")

$helpTopicsMI = GuiCtrlCreateMenuitem ("Help Topics",$aboutMenu)

$separator = GuiCtrlCreateMenuitem ("",$aboutMenu)

$aboutMI = GuiCtrlCreateMenuitem ("About SI",$aboutMenu)

$test=GUICreate("test", 800, 30, 0, 0, $WS_CHILD, Default, $main)

GUISetState ()

$hToolbar = _Toolbar_Create($test)

; Add standard system bitmaps

_Toolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons

_Toolbar_AddButton ($hToolbar, $idNew , $STD_FILENEW )

_Toolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)

_Toolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)

_Toolbar_AddButtonSep($hToolbar)

_Toolbar_AddButton ($hToolbar, $idHelp, $STD_HELP )

;$viewSpell = GUICtrlCreateButton ("1", 0,0,30,30,$BS_ICON)

;GUICtrlSetImage (-1, "shell32.dll",134)

$test2=GUICreate("test", 700, 400, 0, 30, $WS_CHILD, Default, $main)

GUISetState ()

$child = GUICreate("View Spells", 200, 200, 40, 40, BitOR($WS_OVERLAPPEDWINDOW, $WS_CHILD, $WS_MAXIMIZE), Default, $test2)

GUISetState ()

do

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $exitMI

ExitLoop

Case $msg = $aboutMI

Msgbox(0,"About","Spell Inventory")

EndSelect

until $msg = $GUI_EVENT_CLOSE

GUIDelete()

Exit

Share this post


Link to post
Share on other sites

I thinks i got it...

#include <GUIConstants.au3>
;#include <database.au3>
#include <A3LToolbar.au3>

Global Enum $idNew=1000, $idOpen, $idSave, $idHelp

; Script Start - Add your code below here
$main = GUICreate("Spell Inventory", 800, 500, -1,-1, $WS_OVERLAPPEDWINDOW)

GUISetState ()

$dbname = "C:\Documents and Settings\sjraisbe\Desktop\SI\database.mdb"
$tblname = "Spells"
$fldname = "Spell"

;MI = menu item
;-----File Menu-----
$fileMenu = GuiCtrlCreateMenu ("File")
$importMI = GuiCtrlCreateMenuitem ("Import File",$filemenu)
$separator = GuiCtrlCreateMenuitem ("",$filemenu)
$ppOptionsMenu = GuiCtrlCreateMenu ("Print Preview Options",$filemenu)
$separator = GuiCtrlCreateMenuitem ("",$filemenu)
$exitMI = GuiCtrlCreateMenuitem ("Exit",$filemenu)

;-----Tools Menu-----
$toolsMenu = GuiCtrlCreateMenu ("Tools")
$manageSpellbooksMI = GuiCtrlCreateMenuitem ("Manage Spellbooks",$toolsMenu)
$manageSchoolsMI = GuiCtrlCreateMenuitem ("Manage Schools",$toolsMenu)
$manageSpellsMI = GuiCtrlCreateMenuitem ("Manage Spells",$toolsMenu)
$separator = GuiCtrlCreateMenuitem ("",$toolsMenu)
$manageScrollsMI = GuiCtrlCreateMenuitem ("Manage Scrolls",$toolsMenu)
$separator = GuiCtrlCreateMenuitem ("",$toolsMenu)
$searchMI = GuiCtrlCreateMenuitem ("Search",$toolsMenu)

;-----Window Menu-----
$windowMenu = GuiCtrlCreateMenu ("Window")
$tileMI = GuiCtrlCreateMenuitem ("Tile",$windowMenu)
$separator = GuiCtrlCreateMenuitem ("",$windowMenu)
$cascadeMI = GuiCtrlCreateMenuitem ("Cascade",$windowMenu)

;-----About Menu-----
$aboutMenu = GuiCtrlCreateMenu ("About")
$helpTopicsMI = GuiCtrlCreateMenuitem ("Help Topics",$aboutMenu)
$separator = GuiCtrlCreateMenuitem ("",$aboutMenu)
$aboutMI = GuiCtrlCreateMenuitem ("About SI",$aboutMenu)

$hToolbar = _Toolbar_Create($main)

; Add standard system bitmaps
_Toolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_Toolbar_AddButton ($hToolbar, $idNew , $STD_FILENEW )
_Toolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_Toolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_Toolbar_AddButtonSep($hToolbar)
_Toolbar_AddButton ($hToolbar, $idHelp, $STD_HELP )

;$viewSpell = GUICtrlCreateButton ("1", 0,0,30,30,$BS_ICON)
;GUICtrlSetImage (-1, "shell32.dll",134)

$child = GUICreate("View Spells", 200, 200, 40, 0, $WS_OVERLAPPEDWINDOW)
DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($child), "hwnd", WinGetHandle($main))
GUISetState ()



do
    
    $main_loc = WinGetPos($main)
    $child_loc = WinGetPos($child)
    If $child_loc[1] < ($main_loc[1] + 75) then WinMove($child, "", -2, 30)
    
$msg = GUIGetMsg()


Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $exitMI
ExitLoop

Case $msg = $aboutMI
Msgbox(0,"About","Spell Inventory")
EndSelect

until $msg = $GUI_EVENT_CLOSE

GUIDelete()

Exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

did you gets it????

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

See the second post, i managed to get it to maximize below the tool bar but now i need it to resize along with $main.

I have been experimenting with WinGetPos and WinMove for the resizing issue but i am having trouble getting the right sizes. It looks like AutoIt Window info is incorrect on window size or my math sucks.

Here is the new code, i added buttons so i can see where the bottom of the window is.

CODE
#include <GUIConstants.au3>

;#include <database.au3>

#include <A3LToolbar.au3>

Global Enum $idNew=1000, $idOpen, $idSave, $idHelp

; Script Start - Add your code below here

$main = GUICreate("Spell Inventory", 800, 500, -1,-1, $WS_OVERLAPPEDWINDOW)

GUISetState ()

$dbname = "C:\Documents and Settings\sjraisbe\Desktop\SI\database.mdb"

$tblname = "Spells"

$fldname = "Spell"

;MI = menu item

;-----File Menu-----

$fileMenu = GuiCtrlCreateMenu ("File")

$importMI = GuiCtrlCreateMenuitem ("Import File",$filemenu)

$separator = GuiCtrlCreateMenuitem ("",$filemenu)

$ppOptionsMenu = GuiCtrlCreateMenu ("Print Preview Options",$filemenu)

$separator = GuiCtrlCreateMenuitem ("",$filemenu)

$exitMI = GuiCtrlCreateMenuitem ("Exit",$filemenu)

;-----Tools Menu-----

$toolsMenu = GuiCtrlCreateMenu ("Tools")

$manageSpellbooksMI = GuiCtrlCreateMenuitem ("Manage Spellbooks",$toolsMenu)

$manageSchoolsMI = GuiCtrlCreateMenuitem ("Manage Schools",$toolsMenu)

$manageSpellsMI = GuiCtrlCreateMenuitem ("Manage Spells",$toolsMenu)

$separator = GuiCtrlCreateMenuitem ("",$toolsMenu)

$manageScrollsMI = GuiCtrlCreateMenuitem ("Manage Scrolls",$toolsMenu)

$separator = GuiCtrlCreateMenuitem ("",$toolsMenu)

$searchMI = GuiCtrlCreateMenuitem ("Search",$toolsMenu)

;-----Window Menu-----

$windowMenu = GuiCtrlCreateMenu ("Window")

$tileMI = GuiCtrlCreateMenuitem ("Tile",$windowMenu)

$separator = GuiCtrlCreateMenuitem ("",$windowMenu)

$cascadeMI = GuiCtrlCreateMenuitem ("Cascade",$windowMenu)

;-----About Menu-----

$aboutMenu = GuiCtrlCreateMenu ("About")

$helpTopicsMI = GuiCtrlCreateMenuitem ("Help Topics",$aboutMenu)

$separator = GuiCtrlCreateMenuitem ("",$aboutMenu)

$aboutMI = GuiCtrlCreateMenuitem ("About SI",$aboutMenu)

$test=GUICreate("test", 800, 30, 0, 0, $WS_CHILD, Default, $main)

GUISetState ()

$hToolbar = _Toolbar_Create($test)

; Add standard system bitmaps

_Toolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons

_Toolbar_AddButton ($hToolbar, $idNew , $STD_FILENEW )

_Toolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)

_Toolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)

_Toolbar_AddButtonSep($hToolbar)

_Toolbar_AddButton ($hToolbar, $idHelp, $STD_HELP )

;$viewSpell = GUICtrlCreateButton ("1", 0,0,30,30,$BS_ICON)

;GUICtrlSetImage (-1, "shell32.dll",134)

$test2=GUICreate("test2", 800, 466, 0, 30, $WS_CHILD, Default, $main)

GUICtrlCreateButton ("OK",50,420,50,50)

GUICtrlSetResizing (-1,$GUI_DOCKBOTTOM)

GUISetState ()

;WinMove($test2, '', 0, 30, 300, 300)

$child = GUICreate("View Spells", 200, 200, 40, 40, BitOR($WS_OVERLAPPEDWINDOW, $WS_CHILD), Default, $test2)

Opt("GUICoordMode", 2)

$nOk = GUICtrlCreateButton ("OK",50,150,50,50) ; add the button that will close the GUI

GUICtrlSetResizing ($nOk,$GUI_DOCKBOTTOM)

GUISetState ()

do

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $exitMI

ExitLoop

Case $msg = $aboutMI

Msgbox(0,"About","Spell Inventory")

Case $msg = $GUI_EVENT_RESIZED or $GUI_EVENT_MAXIMIZE or $GUI_EVENT_RESTORE

$state = WinGetState($child)

If BitAnd($state, 32) Then

$array = WinGetPos($main)

WinMove($test2, '', 0, 30, ($array[2]-8), ($array[3]-34))

WinMove($child, '', -5, 0, $array[2], ($array[3]-34))

EndIf

EndSelect

until $msg = $GUI_EVENT_CLOSE

GUIDelete()

Exit

Share this post


Link to post
Share on other sites

if you would look at what i did, you could easily get what you want now

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Thanks for your help. I did it alittle different than you suggested, this way it acts like the file menu more since you can drag a window up and it goes behind the toolbar.

Here is the code

CODE
#include <GUIConstants.au3>

;#include <database.au3>

#include <A3LToolbar.au3>

Global Enum $idNew=1000, $idOpen, $idSave, $idHelp

; Script Start - Add your code below here

$main = GUICreate("Spell Inventory", 800, 500, -1,-1, $WS_OVERLAPPEDWINDOW)

GUISetState ()

$dbname = "C:\Documents and Settings\sjraisbe\Desktop\SI\database.mdb"

$tblname = "Spells"

$fldname = "Spell"

;MI = menu item

;-----File Menu-----

$fileMenu = GuiCtrlCreateMenu ("File")

$importMI = GuiCtrlCreateMenuitem ("Import File",$filemenu)

$separator = GuiCtrlCreateMenuitem ("",$filemenu)

$ppOptionsMenu = GuiCtrlCreateMenu ("Print Preview Options",$filemenu)

$separator = GuiCtrlCreateMenuitem ("",$filemenu)

$exitMI = GuiCtrlCreateMenuitem ("Exit",$filemenu)

;-----Tools Menu-----

$toolsMenu = GuiCtrlCreateMenu ("Tools")

$manageSpellbooksMI = GuiCtrlCreateMenuitem ("Manage Spellbooks",$toolsMenu)

$manageSchoolsMI = GuiCtrlCreateMenuitem ("Manage Schools",$toolsMenu)

$manageSpellsMI = GuiCtrlCreateMenuitem ("Manage Spells",$toolsMenu)

$separator = GuiCtrlCreateMenuitem ("",$toolsMenu)

$manageScrollsMI = GuiCtrlCreateMenuitem ("Manage Scrolls",$toolsMenu)

$separator = GuiCtrlCreateMenuitem ("",$toolsMenu)

$searchMI = GuiCtrlCreateMenuitem ("Search",$toolsMenu)

;-----Window Menu-----

$windowMenu = GuiCtrlCreateMenu ("Window")

$tileMI = GuiCtrlCreateMenuitem ("Tile",$windowMenu)

$separator = GuiCtrlCreateMenuitem ("",$windowMenu)

$cascadeMI = GuiCtrlCreateMenuitem ("Cascade",$windowMenu)

;-----About Menu-----

$aboutMenu = GuiCtrlCreateMenu ("About")

$helpTopicsMI = GuiCtrlCreateMenuitem ("Help Topics",$aboutMenu)

$separator = GuiCtrlCreateMenuitem ("",$aboutMenu)

$aboutMI = GuiCtrlCreateMenuitem ("About SI",$aboutMenu)

$test=GUICreate("test", 800, 30, 0, 0, $WS_CHILD, Default, $main)

GUISetState ()

$hToolbar = _Toolbar_Create($test)

; Add standard system bitmaps

_Toolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons

_Toolbar_AddButton ($hToolbar, $idNew , $STD_FILENEW )

_Toolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)

_Toolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)

_Toolbar_AddButtonSep($hToolbar)

_Toolbar_AddButton ($hToolbar, $idHelp, $STD_HELP )

;$viewSpell = GUICtrlCreateButton ("1", 0,0,30,30,$BS_ICON)

;GUICtrlSetImage (-1, "shell32.dll",134)

$width = 800

$height = 450

$test2=GUICreate("test2", $width, $height, 0, 30, $WS_CHILD, Default, $main)

GUISetBkColor (0x0FFFF)

GUICtrlCreateButton ("OK",$width-50,$height-50,50,50)

GUICtrlSetResizing (-1,$GUI_DOCKBOTTOM+$GUI_DOCKSIZE)

GUISetState ()

;WinMove($test2, '', 0, 30, 300, 300)

$width = 200

$height = 200

$child = GUICreate("View Spells", 200, 200, 30, 30, BitOR($WS_OVERLAPPEDWINDOW, $WS_CHILD), Default, $test2)

GUISetBkColor (0x00FF00)

Opt("GUICoordMode", 2)

$nOk = GUICtrlCreateButton ("OK",$width-48,$height-48,50,50) ; add the button that will close the GUI

GUICtrlSetResizing ($nOk,$GUI_DOCKBOTTOM+$GUI_DOCKSIZE)

GUISetState ()

do

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $exitMI

ExitLoop

Case $msg = $aboutMI

Msgbox(0,"About","Spell Inventory")

Case $msg = $GUI_EVENT_RESIZED or $GUI_EVENT_MAXIMIZE or $GUI_EVENT_RESTORE

$state = WinGetState($child)

$array = WinGetPos($main)

WinMove($test2, '', 0, 30, ($array[2]-8), ($array[3]-84))

If BitAnd($state, 32) Then

; x, y, width, heighth

WinMove($child, '', -4, -4, $array[2], ($array[3]-76))

EndIf

EndSelect

until $msg = $GUI_EVENT_CLOSE

GUIDelete()

Exit

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