Page 1 of 1

Two Qs re Rich Text

Posted: Wed Aug 25, 2004 2:23 am
by Dare2
Not sure if this should be here or beginners.

Q1.
I am trying to get the length of a length of rich text, using the following structure and call:

Code: Select all

Structure q_GETTEXTLENGTHEX
  Flags.l
  CodePage.l
EndStructure
...
   edGad=EditorGadget(#_rich, szLtxt, szTtxt, szWtxt, szHtxt)
...
   tmp.q_GETTEXTLENGTHEX
   tmp\Flags=0 ;#_qGTL_NUMCHARS  ;#_qGTL_DEFAULT
   tmp\CodePage=0  ;#_qCP_ACP
   totChr=SendMessage_(edGad,#_qEM_GETTEXTLENGTH,@tmp,0)
Always returns totChr=0 and have tried different options.

I was hoping to get this value to allocate memory for a streaming op prior to streamout, but so far have to rely on the callback values.

EDIT: Value of #_qEM_GETTEXTLENGTH is set to #WM_USER+95

Q2:
Is there any way to change the background colour for just a selection of the text.

Thanks. :)

Posted: Wed Aug 25, 2004 2:56 am
by freak
about Q1

Dunno why your code dosn't work right, but this one does the trick:

Code: Select all

totChr = SendMessage_(edGad, #WM_GETTEXTLENGTH, 0, 0)
about Q2

look here: viewtopic.php?t=6666

(in my second post you'll find the code for the background color)


btw, why do you recreate all structures and constants? they are allready there.

Timo

Posted: Wed Aug 25, 2004 4:05 am
by Dare2
Heya Timo.

Thanks for the answers. :)
freak wrote:btw, why do you recreate all structures and constants? they are allready there.
I must have something missing.

Some things like GETTEXTLENGTHEX, #EM_GETTEXTLENGTH, #GTL_NUMCHARS come up with structure/constant not found.

However other things like CHARFORMAT, #EM_LINEFROMCHAR, #ENM_KEYEVENTS are there. So is #WM_GETTEXTLENGTH ( which I didn't use originally, but your snippet now in place in my code :) ) - most are there, just a few jack up.

Anyhow, thanks again.