IonicWind Software

Creative Basic => General Questions => Topic started by: tbohon on July 23, 2013, 02:14:57 pm

Title: Working with a Rich Edit Control --- RESOLVED
Post by: tbohon on July 23, 2013, 02:14:57 pm
Simple solution that I simply misread ... use the following:

Code Select

CONTROLCMD w1, 1, @RTSETSELFONT, "Lucida Console", 11, 1, 0

That tells CB to take the current selected text in window w1 and set the font to (what it was before) Lucida Console size 11 and apply BOLD to it (the '1' in the next-to-last place) with no other effects (the '0' in the last location).  Documentation on RE controls will clarify this for you if interested.

Gotta learn to read carefully ... :)

Thanks anyway - maybe this will help someone else ...

For the first time I'm incorporating a richedit control into a CB program and have run into a (hopefully) small problem.
In my program I have a RE control and need to bold a term I've located in a line.  I can select the term, not a problem ... but can't for the life of me figure out how to bold just that one word before repainting the screen.  I've looked through the documentation on RE controls several times and don't see anything about bold/underline/italicize so am thinking it's somewhere else in a different command ... but where?

Any thoughts from others here would be appreciated.

Thanks in advance.

Title: Re: Working with a Rich Edit Control --- RESOLVED
Post by: aurelCB on July 24, 2013, 09:14:21 am
It is easy look here:
QuoteChanging the font
The text printed to a window will use the default font specified in the display control panel unless changed with the SETFONT statement. The SETFONT statement has the syntax of:

SETFONT window, typeface, height, weight {, flags | charset} {,ID}

Height and weight can both be 0 in which case a default size and weight will be used. Weight ranges from 0 to 1000 with 700 being standard for bold fonts and 400 for normal fonts. Flags can be a combination of @SFITALIC, @SFUNDERLINE, or @SFSTRIKEOUT  for italicized,  underlined, and strikeout fonts. If an ID is specified then the font of a control in the window or dialog is changed.

Example fragment:

SETFONT mywin, "Ariel", 20, 700, @SFITALIC
PRINT mywin, "ARIEL bold italic"

Title: Re: Working with a Rich Edit Control --- RESOLVED
Post by: Brian on July 24, 2013, 12:49:48 pm
Tom, When I get my program window sizing answer sorted, I'll send the program to you

It's a richedit word processor I wrote yonks ago, but never did anything with it. I've just
tested it, and it will bold a word or sequence of words inside a line (which I think is what
you wanted)

Title: Re: Working with a Rich Edit Control --- RESOLVED
Post by: tbohon on July 25, 2013, 09:59:13 am
That would be great Brian ... I'm learning a lot as I make mistakes but seeing a working example would be spectacular.

What I'm actually wanting to do is bold or color the first word of a line - it's for a scripting language I wrote (in C#.Net) to script ftp jobs.  Right now I've cobbled up a syntax coloring list in Notepad++ but wanted to try to write something on my own to avoid any licensing questions later on.