Re: Setting the Font color
> From: Bryan O'Gorman
> I'm trying to change the color of the text in an
> Win32Lib MleText box and then printing a user ID in
> that color. Change the color without prompting the
> user that is. I'm VERY illiterate in C.. if that's
> what my problem is.
You can't have multiple colored text in an MleText box. To do that, you'll
need to use a RichEdit, which hasn't made its way to the official win32lib
release yet, but it's in my extended version. Use setFont to change the
color of a selection of text.
You can use setFont and putStream to accomplish this
> The format is like this:
>
> (green) (your choice)
> userID: message
<snip>
>
> -- <IMPORTANT PART>
> -- Send the message you have typed in the
> -- sendmsg control
> procedure IMsendMessage()
>
> -- This is a space filler for now
> current = getText(msgs)
> msg = getText(sendmsg)
> setText(sendmsg, "")
> -- Right here is where I want to set
> -- the font color for the variable
> -- userID
-- Instead of setText, use:
setFont( sendmsg, {useridcolor, fontName}, pointSize,
attributes)
-- If we don't use StreamSelection, then the entire contents will be
replaced
putStream( sendmsg, or_bits(StreamSelection, StreamText),
"userID:" )
setFont( sendmsg, {defaultcolor, fontName}, pointSize,
attributes)
putStream( sendmsg, or_bits(StreamSelection, StreamText),
msg & CRLF & current )
> setText(msgs, userID&": "&msg&CRLF¤t)
>
> end procedure
> -- </IMPORTANT PART>
>
Hope this helps.
Matt
|
Not Categorized, Please Help
|
|