Two Qs re Rich Text

Windows specific forum
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Two Qs re Rich Text

Post 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. :)
@}--`--,-- A rose by any other name ..
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post 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.
@}--`--,-- A rose by any other name ..
Post Reply