You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
User to user discussions about the PB/Win (formerly PB/DLL) product line. Discussion topics include PowerBASIC Forms, PowerGEN and PowerTree for Windows.
First of all, don't use a TEXTBOX (edit) control. Do you really want your users EDITING a field which appears in multiple fonts? I didn't think so.
A LABEL (static) control would be a better choice for a display-only control.
Ok, the two ways:
1. Instead of using a single control, use two controls, one for the "normal" font and one for the "bold" font, located right next to the "normal" font . Use the appropriate font setting command for the "bold" control. I don't think there is a DDT "CONTROL SET FONT" command, so you will have to "CONTROL SEND CBHNDL, %ID_CONTROL, %WM_SETFONT, hFont, %NULL"
This method stinks, because to get the text to look like "one piece of text" you will have to adjust the location of the BOLD control every time the text changes in the NORMAL control. While "doable" it will not be fun, at all.
2. Create the LABEL control with style SS_OWNERDRAW; on the WM_DRAWITEM notification you will draw the text yourself.
This WILL involve making some GDI calls to the WinAPI. There are no DDT commands to handle this.
There may or may not be a demo of this here, somewhere. Try searching for "WM_DRAWITEM " *and* ( "TextOut" OR "DrawText" )
User to user discussions about the PB/Win (formerly PB/DLL) product line. Discussion topics include PowerBASIC Forms, PowerGEN and PowerTree for Windows.
In later versions of the compiler you have the advantage of Graphic text options too..
>In later versions of the compiler you have the advantage of Graphic text options too..
Darned, I forgot about that! A GRAPHIC CONTROL would make this relatively simple to do I think, since there are text-measuring 'DDT' commands built in.
(The compiler version thing will have to be a separate issue.)
To create a static control using the CreateWindow or CreateWindowEx function, specify the STATIC class, appropriate window style constants, and a combination of the following static control styles.
hi,
i cant find even SS_OWNERDRAW, could u post an example to make things simpler to me, i am a newbie to PBa dn BASIC generally.
thanks
Raed, As a "newby to PB AND to BASIC generally" (your Oct 2008 forum join date noted), what you are asking to do (mixing fonts on the same line) is a pretty advanced project. I would suggest taking things a little slower until you have a little more experience with Basic (and PB).
A couple ways to do it were suggested but both are *relatively* advanced and would probably, even likely, to be confusing to a newby.
Not trying to discourage you at all. Only wouldn't like to see you be unnecessarily daunted in the dawn of could be a bright, promising, delightful, exciting, satisfying PB experience for you (and maybe us) by *relatively* sophisticated techniques.
(Note that posted, someone will probably post a simple 5 line routine to do what Raed asks. {sigh})
=======================================
"Logic is in the eye of the logician."
Gloria Steinem
=======================================
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment