The value mIRC returns for $dialog($dname).ch is inaccurate when the dialog contains a menu bar. Example:
alias bugdialog dialog -mv bugtest bugtest
dialog bugtest {
option pixels
size -1 -1 400 400
menu "Menu", 1
}
alias bugtest {
echo -a Before- cw: $+ $dialog(bugtest).cw ch: $+ $dialog(bugtest).ch
dialog -s bugtest -1 -1 $dialog(bugtest).cw $dialog(bugtest).ch
echo -a After - cw: $+ $dialog(bugtest).cw ch: $+ $dialog(bugtest).ch
echo -a --
}
/bugdialog
/bugtest
-genius_at_work
If mIRC is using GetWindowRect this is a bug,
If mIRC is using GetClientRect it's not. In that case it would be a Windows behaviour.
Technicality aside, I can see the use of either value though.. some people might need the menusize incorporated into the height, others may not, though I suppose if mIRC reported the "proper" client height you could do (windowheight - clientheight) to get the menu bar size.
The problem is that there is a difference between /dialog -s and $dialog().ch. I don't think it matters which value is used, just that it is consistent between reading and setting the height.
dialog -s $dname $dialog($dname).x $dialog($dname).y $dialog($dname).cw $dialog($dname).ch
This code should "change" the dialog size and location to its current size and location (ie. no movement or resize).
Maybe a new $dialog property should be created to return "height including menu".
-genius_at_work
Actually, it seems like the problem is with the /dialog -s command, rather than the $dialog().ch identifier.
- create a dialog with a size of 200px x 200px with 0 menus
- //echo -a $dialog($dname).ch = 200px
- //dialog -s $dname -1 -1 200 $dialog($dname).ch
- create a dialog with a size of 200px x 200px with 3 menus (should create 1 row of menus)
- //echo -a $dialog($dname).ch = 200px
- //dialog -s $dname -1 -1 200 $dialog($dname).ch
- //echo -a $dialog($dname).ch = 180px
- create a dialog with a size of 200px x 200px with 6 menus (should create 2 rows of menus)
- //echo -a $dialog($dname).ch = 200px
- //dialog -s $dname -1 -1 200 $dialog($dname).ch
- //echo -a $dialog($dname).ch = 160px
This shows that when the dialog is first created, the client area h=200px + menu height (seems logical). When you read $dialog().ch, you get the client area excluding the additional menu height (also seems logical). However, when you change the dialog size using /dialog -s, the menu height is SUBTRACTED from the client area (200px) causing the new client area to be smaller.
The action of /dialog -s is incorrect (in my opinion).
-genius_at_work