The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: hfheatherfox07 on July 24, 2011, 02:07:03 AM

Title: Edit box, with multiple line and color
Post by: hfheatherfox07 on July 24, 2011, 02:07:03 AM
Hi  I created an Edit box, with multiple line and color , does anybody know why when I press"Backspace" the cursor just moves back instead of deleting ...

Also How to delete the whole screen like in Console app I need to be able to delete all the text with a button or hotkey
Title: Re: Edit box, with multiple line and color
Post by: xandaz on July 24, 2011, 04:06:53 PM
    relative to the fact that backspace just moves backwords you must remind that you used TRANSPARENT as BkMode. You should use opaque and EM_SETCHARFORMAT for the colors. To delete the whole text send a WM_SETTEXT with a null string usually works.
    Hope it was helpful
Title: Re: Edit box, with multiple line and color
Post by: xandaz on July 24, 2011, 04:07:41 PM
   correction.... you dont really need to use bkmode in edit controils ...
Title: Re: Edit box, with multiple line and color
Post by: bomz on July 24, 2011, 04:10:25 PM
invoke SetWindowLong,hwnD,GWL_WNDPROC,addr NewEditProc
Title: Re: Edit box, with multiple line and color
Post by: hfheatherfox07 on July 24, 2011, 07:09:50 PM
Thank you , I will try this tonight .... :U
Title: Re: Edit box, with multiple line and color
Post by: hfheatherfox07 on July 29, 2011, 01:20:19 PM
Quote from: xandaz on July 24, 2011, 04:06:53 PM
    relative to the fact that backspace just moves backwords you must remind that you used TRANSPARENT as BkMode. You should use opaque and EM_SETCHARFORMAT for the colors. To delete the whole text send a WM_SETTEXT with a null string usually works.
    Hope it was helpful

What this did for me was to have only 1 line that is the background color and the text color that I want ?
Title: Re: Edit box, with multiple line and color
Post by: hfheatherfox07 on July 29, 2011, 01:22:29 PM
Quote from: bomz on July 24, 2011, 04:10:25 PM
invoke SetWindowLong,hwnD,GWL_WNDPROC,addr NewEditProc

This crashes my app :(
Title: Re: Edit box, with multiple line and color
Post by: Gunner on July 29, 2011, 02:34:05 PM
Do you know why it crashed your app?  Did you lookup SetWindowLong and see what the WNDPROC flag makes it return?

You are telling Windows to use NewEditProc as the new callback for that control - did you create that proc the same way other window msg handler callbacks are created?

2 - bomz left out one important thing - SetWindowLong returns the address of the original proc for that control that you MUST save, and in the new proc you MUST use that address with CallDefProc (something like that) for ALL messages not handled...