i have 3 controls on my main window i need resized when the main window is being resized. im not sure on the method i need to use. here is a little picture i made up to illustrate what i want to do.
Posted on 2002-02-07 23:49:59 by smurf
Process the WM_SIZE message first. The easiest way I have found is to use the leftmost, topmost window as the reference point. For instance when you resize the upper right window just use the size of the main client area minus the width of the upper left window minus the width of the separator bar. Anyway I just use the top left window dimensions and the client dimensions together to come up with the sizes of the other windows. If you need some sample code just ask.
Posted on 2002-02-08 00:03:20 by rdaneel
radneel your method on resizing the width is very clear to me but yet im still confused on how to go about the hidth of my controls. it seems like it maybe kinda tricky ill just think on it for a bit.
Posted on 2002-02-08 00:16:17 by smurf
I hope I understood your description well, here's an example.

The important parts are:
data


.data?

hControl1 dd ?
hControl2 dd ?
hControl3 dd ?


CONTROL3HEIGHT equ 240
CONTROL1WIDTH equ 200


on WM_SIZE


.elseif uMsg == WM_SIZE
push esi
push edi
push ebx

invoke GetClientRect, hWin, addr Rct
mov ebx, Rct.right
sub ebx, Rct.left [COLOR=seagreen];eax is main window width[/color]

mov esi, Rct.bottom
sub esi, Rct.top [COLOR=seagreen] ;esi is main window height[/color]

[COLOR=seagreen] ; Calculate height of control 1:
; control1height = mainwindowheight - CONTROL3HEIGHT[/color]
mov edi, esi
sub edi, CONTROL3HEIGHT [COLOR=seagreen];edi = control1 height[/color]

invoke MoveWindow, hControl1, Rct.left, Rct.top, CONTROL1WIDTH, edi, TRUE

[COLOR=seagreen] ; Calculate left pos, width & height for control 2:
; control2left = Rct.left + CONTROL1WIDTH
; control2width = maincontrolwidth - control2left
; control2height = control1height = edi (!)[/color]

mov eax, Rct.left
add eax, CONTROL1WIDTH [COLOR=seagreen];eax=control2left[/color]

mov ecx, ebx [COLOR=seagreen];main window width[/color]
sub ecx, eax [COLOR=seagreen]; - control2left = control2width (=ecx)[/COLOR]

invoke MoveWindow, hControl2, eax, Rct.top, ecx, edi, TRUE

[COLOR=seagreen]; Calculate top & height for control3:
; control3top = Rct.top + control1height (edi) = Rct.top + edi
; control3widht = mainwindowwidth = ebx (!)[/COLOR]

mov eax, Rct.top
add eax, edi [COLOR=seagreen];eax = control3top[/COLOR]
invoke MoveWindow, hControl3, Rct.left, eax, ebx, CONTROL3HEIGHT, TRUE


pop ebx
pop edi
pop esi


Thomas
Posted on 2002-02-08 02:25:37 by Thomas
Hmm forgot attachment..
Posted on 2002-02-08 03:08:54 by Thomas
Remember to set minimum and maximum values for the width and height of the windows if you are using separator bars to resize them otherwise you can resize them straight off the edge of the window.
Posted on 2002-02-08 10:03:09 by rdaneel
Consider using DeferWindowPos instead of MoveWindow to avoid flickering.
Posted on 2002-02-08 10:14:24 by japheth
thomas: thank you that was perfect.

japheth: interesting api looks to be very powerful
Posted on 2002-02-08 10:38:25 by smurf