now I am writing a richeditor, i added a view menu to show or hide toolbar and statusbar, but something wrong happened. after hide toolbar, when mouse move to the original position of toolbar, toolbar was partially showed, richedit control can't cover it entirety, i think windows need repainting, but i don't know how to do it; when I show toolbar again thu menu command, toolbar show without any button and bitmap, before I add this funtion, everything is OK

below is the snippet code:

;==============================================================
;show or hide toolbar command
.ELSEIF ax == IDM_TOOLBAR
test fOptions, 01b
.IF !zero?
mov eax, SW_SHOW
.ELSE
mov eax, SW_HIDE
.endif
invoke ShowWindow, hToolBar, eax
xor fOptions, 01b
invoke SendMessage, hMain, WM_SIZE, 0, 0

;==============================================================

;==============================================================
.ELSEIF uMsg == WM_SIZE
invoke SendMessage, hToolBar, TB_AUTOSIZE,0,0
invoke SendMessage, hStatusBar, WM_SIZE, SIZE_RESTORED, 0
mov height, 0
mov top, 0
test fOptions, 01b
.if !zero?
invoke GetWindowRect, hToolBar, ADDR rect
mov eax, rect.bottom
sub eax, rect.top
mov height, eax
mov top, eax
.endif
test fOptions, 10b
.if !zero?
invoke GetWindowRect, hStatusBar, ADDR rect
mov eax, rect.bottom
sub eax, rect.top
add height, eax
.endif
invoke GetClientRect, hMain, ADDR rect
mov eax, rect.bottom
sub eax, height
mov height, eax
invoke MoveWindow, hEdit, 0, top, rect.right, height, TRUE
invoke SetFocus, hEdit
;==============================================================
Posted on 2002-02-19 11:55:50 by dREAMtHEATER
Hi dREAMtHEATER

In WM_SIZE you should test if the toolbar is visible before you autosize it. Same goes for statusbar.

KetilO
Posted on 2002-02-19 13:21:36 by KetilO
Hi KetilO

the flag fOptions test toolbar or statusbat if show or hide, according your advice i change it, but it still doesn't work, can you give me a sample you write, I will very appreciate your help.

dREAMtHEATER
Posted on 2002-02-19 22:31:52 by dREAMtHEATER
Hi dREAMtHEATER

Well, here it is.

KetilO
Posted on 2002-02-20 02:58:45 by KetilO