I have an editbox I have subclassed and I update it using SendMessage..? in other words,
I don't type in this editbox at all, I catch the input first and then send stuff to this editbox.

My questions are:

1)? How do I append to the end of an editbox so it scrolls upwards?

2)? Can I limit the amount of scrolling info in an editbox so it never maxes out?? Kind of a roll-in roll-out type of thing?

3)? When my screen redraws, the editbox becomes invisible until I do a SendMessage.. to it again - guess it doesn't redraw automatically?
How do I fix it?

Thanks.
Posted on 2005-04-28 13:47:32 by drarem
Below is my subclassed code, when I hit the up arrow or other, nothing populates the editbox, yet when I hit 'a' or anything else it is sent to the edit box and is displayed,
along with the string built by wsprintf.? I really want to restrict any input going to the editbox except for the keys I hit via KEYDOWN message but that should be simple to figure out. My main issue is updating the editbox appropriately.

Here is wndproc, I use GetDlgItem to get the hwnd of the editbox:


WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL Ps:POINT
mov eax,uMsg
.if eax==WM_INITDIALOG
push hWin
pop hWnd
invoke GetDlgItem,hWin,1001
mov dlgportal,eax
invoke GetDlgItem,hWin,1002
mov dlgmsg,eax



... and the control ...


EditWndProc proc hWin? ?:DWORD,
? ? ? ? ? ? ? uMsg? ?:DWORD,
? ? ? ? ? ? ? wParam :DWORD,
? ? ? ? ? ? ? lParam :DWORD
LOCAL lpRect:RECT

mov lpRect.left,0
mov lpRect.top,0
mov lpRect.right,800
mov lpRect.bottom,200

.if uMsg==WM_KEYDOWN
GETKEY
test byte ptr , 80h? ;is the LEFT arrow key pressed?
jz @F ;if not, jump forward to next label @@
sub px,4? ? ? ? ? ? ? ? ? ? ? ? ? ;else do all this
mov pm,2
add pt,1
invoke wsprintf, addr CMDLINE, addr CMDFMT, addr CMDW
@@:
test byte ptr , 80h
jz @F
add px,4
mov pm,1
add pt,1
invoke wsprintf, addr CMDLINE, addr CMDFMT, addr CMDE
@@:
test byte ptr , 80h
jz @F
sub py,4
mov pm,1
add pt,1
invoke wsprintf, addr CMDLINE, addr CMDFMT, addr CMDN
@@:
test byte ptr , 80h
jz @F
add py,4
mov pm,1
add pt,1
invoke wsprintf, addr CMDLINE, addr CMDFMT, addr CMDS
@@:
test byte ptr , 80h
jz @F
mov bQuit,TRUE
@@:
invoke SendMessage,dlgmsg,WM_SETTEXT,0,addr CMDLINE
invoke CallWindowProc,OldWndProc,hWin,uMsg,wParam,lParam
ret
.endif

invoke CallWindowProc,OldWndProc,hWin,uMsg,wParam,lParam
ret

EditWndProc endp
Posted on 2005-04-28 15:00:28 by drarem
After spending half a day with this, I dropped the editbox and am now using textout/bitblt. I'll keep track of the the line position and scroll the text up by the font height..
Posted on 2005-04-28 18:34:46 by drarem
drarem, I do not know if I undertand what you want, but...I will make a try.

This procedure can append text to an edit box (writting on the fly)


println proc edit:DWORD, lpszText:DWORD
    jmp @F
szEndLine db 13,10,0
@@:
    ; ----- -----
    invoke SendMessage, edit, EM_SETSEL, -1, 0
    ; ----- -----
    invoke SendMessage, edit, EM_REPLACESEL, FALSE, lpszText
    ; ----- -----
    invoke SendMessage, edit, EM_SETSEL, -1, 0
    ; ----- -----
    invoke SendMessage, edit, EM_REPLACESEL, FALSE, addr szEndLine
    ret
println endp


In the subclassed procedure you can do something like this to ignore keys:


If (key pressed is not valid){
    do nothing
}else{
    call Default Window Procedure()
}


Hope it help.

Kecol.-
Posted on 2005-04-28 21:14:16 by Kecol
Thanks, looks like what I needed and may use it in another project, but blitting is the way I should go with this.
Posted on 2005-04-29 07:16:14 by drarem