1. Setting the Font color
--0-846930886-966723484=:23583
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by smv14.iname.net id
SAA22829
Ok, I started programming Euphoria like a week ago.
Granted, I know I'm not the best programmer. But I
searched all the documentation, this list's archive,
and most of the include files. My problem is this:
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.
The format is like this:
(green) (your choice)
userID: message
attached is the actual WHOLE code thus far for my
program, and accompanying database
Here is the code I have for the procedure I'm wanting
to change the font color in:
-- code
include graphics.e
include win32lib.ew
without warning
global sequence current, msg, userID
userID =3D "you"
global constant CRLF =3D #0D & #0A
constant
IM =3D create(Window, "IM Window", 0, Default,
Default, 600, 400, 0),
msgs =3D create(MleText, "",
IM,Default,51,600,400,0),
sendmsg =3D create(EditText, "", IM, Default,
Default, 543, 50, or_all({WS_CHILD, WS_VISIBLE,
ES_AUTOHSCROLL, ES_LEFT, WS_BORDER, WS_TABSTOP,
WS_EX_CLIENTEDGE, WS_EX_ACCEPTFILES})),
sendIM =3D create(PushButton, "&send IM", IM, 544, 1,
49, 49, 0)
-- on resizing of the IM client window, we need to
-- redraw 'sendmsg' and 'msgs'
procedure resizeIM( integer style, integer sizeX,
integer sizeY )
sequence rect
-- get the area in the window not occupied by the
-- status area
rect =3D getClientRect(IM)
-- size the MLE control, less the toolbar and status
moveWindow(msgs, rect[1], 51, rect[3]-rect[1],
rect[4]-rect[2]-51, True)
moveWindow(sendmsg, rect[1], rect[2],
rect[3]-rect[1]-50, 50, True)
moveWindow(sendIM, rect[3]-rect[1]-50, rect[2],
50,50, True)
end procedure
-- <IMPORTANT PART>
-- Send the message you have typed in the
-- sendmsg control
procedure IMsendMessage()
-- This is a space filler for now
current =3D getText(msgs)
msg =3D getText(sendmsg)
setText(sendmsg, "")
-- Right here is where I want to set
-- the font color for the variable
-- userID
setText(msgs, userID&": "&msg&CRLF¤t)
end procedure
-- </IMPORTANT PART>
onClick[sendIM] =3D routine_id("IMsendMessage")
onResize[IM] =3D routine_id("resizeIM")
WinMain(IM, Normal)
__________________________________________________
Do You Yahoo!?
Yahoo! Mail =96 Free email you can access from anywhere!
http://mail.yahoo.com/
--0-846930886-966723484=:23583
Content-Description: program.zip
2. Re: Setting the Font color
by the way, pardon my pathetic excuse of
programming!!!
:-]
__________________________________________________
Do You Yahoo!?
Yahoo! Mail =96 Free email you can access from anywhere!
http://mail.yahoo.com/
3. 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
4. Re: Setting the Font color
- Posted by "Bryan O'Gorman" <bryn_euphoria at YAHOO.COM>
Aug 21, 2000
-
Last edited Aug 22, 2000
Thanks Matt,
Yeah, I had switched to a RichEdit after some help
from Wolf that I greatly appreciated. Your help will
be more than enough!! Thanks a million for the help!
Ciao,
Bryan
__________________________________________________
Do You Yahoo!?
Yahoo! Mail =96 Free email you can access from anywhere!
http://mail.yahoo.com/