News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

edit control text buffer

Started by fattypotato, December 10, 2008, 01:57:18 AM

Previous topic - Next topic

fattypotato

Hi all,

Does a read only multi-line edit control in a dlg  have a text buffer on the heap?  If so, does it hold data
that has yet to be displayed in the ec and would it be possible to view it before it is sent to the ec?

thanks to all

donkey

You should be able to use EM_GETHANDLE to find the handle for the text buffer of the control. However, I don't think it is allocated in your programs data space by default, if not you would have to set the DS_LOCALEDIT flag and allocate the buffer yourself using EM_SETHANDLE.

Donkey
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

fattypotato

Thanks Donkey.

I tried using EM_GETHANDLE with SendMessage, SendDlgItemMessage... and get back a non-zero, non-neg value in eax so I think you have me on the right track!
I will cast to HLOCAL  and pass to LocalLock and see what I get.

your help really appreciated!

~jim

Tedd

Depending exactly what you're trying to achieve, that might not be the best way to do it.
For example, you can vet/filter the input text as it's input (and before it's displayed.)
So, what are you doing? :P
No snowflake in an avalanche feels responsible.

fattypotato

Ted,

I'm loading a ro edit ctrl with a string from a database.  When the string is long enough to cause a wordbreak I want the next line to start 4 spaces from the left.
for example I get this:

A.) When the string is long enough to cause a wordbreak in the ec, say here
the next line starts against the left side of the ec.

but I want this:

A.) When the string is long enough to cause a wordbreak in the ec, say here
     the next line will start here as well as all other lines in the same sentence
     that cause subsequent wbs.

B.) then the next string will be loaded to the far left side again and so on....
     and so on.

The ec is loaded giving the address of the string, which has been pre-formated with cr/lf's, to SendDlgItemMessage and everything works perfectly except what I've said.
     
I'll try any ideas you have.  I'm currently looking at wordwrap procs and EM_FMTLINES.  I'm inexperienced so its taking me a while to find all this stuff and figure out what to give it.
Thanks for your reply

~jim

Tedd

So you want to indent all but the first line of each paragraph?

Playing with word-break and em_fmtlines won't help much here - they don't give you that kind of control; you do need to modify the text.

If you catch the EN_UPDATE notification (it comes in a WM_COMMAND message), then you have the chance to intercept any modifications to the edit control's text before it's displayed.

However, since you're loading strings directly into a read-only edit (so it's not going to be modified further,) I think the simplest way would be to load the string into memory, format it into another buffer (insert any line-breaks, indentation, etc) and then insert that text into the edit control.
No snowflake in an avalanche feels responsible.