PDA

View Full Version : Can I find the font specified for a button?



avid
July 15th, 2004, 03:04 AM
Ben,

Following a request from mhwlng (supported by rah99):

* another useful addition would be a read only rich-text multi-line editbox

I could put my album review, lyrics etc. in there....

* transparent edit boxes or a user definable background bitmap in the edit boxes would be nice...

* another thing that I would like is font/colour selection


Marcel
I have been extending my utils driver to do this. The "edit box action" will provide options for read-only, border, multi-line, scroll bar, centered. And it takes the colors and transparency from the CCF. And the automatic smooth scrolling will just become another option.

But I have a problem with the font. I can't find a way in the driver API to get the font which is specified in the CCF. I can probably manage the font *size*, but is there a way to get the actual font?

Brian

avid
July 15th, 2004, 02:51 PM
Ben,

Another problem - sigh!

I was a bit premature when I said my text display could handle transparency. If I use a transparent background to a driver-painted button - NOTHING gets drawn where the button is. When I switch to the panel with the transparent button, the previous contents of that rectangle on the previous panel remain on the screen. Other items on the panel (the frame, other overlapping buttons, etc) are not drawn normaly, but are clipped by the rectangle of the transparent button.

Is this right???? Is there a way round this?

Brian

avid
July 16th, 2004, 03:50 AM
Well, I got around the transparent text problem, but it's ugly.

When painting transparent text, I HIDE the text window and then set a 1ms timer to get it re-shown. This gives time for the normal WM_PAINT processing to paint behind the window. Ugh!!

Have you heard the old saying "When all you've got is a hammer, everything looks like a nail"? well I'm begining to think that way about the new timer mechanism. But it has got me out of a few holes.

Brian

Ben S
July 17th, 2004, 08:25 PM
To get the font size, you can call

INetRemotePaint::GetFont(CCFButton::GetFontSize()-1) which will return a pointer to the CFont for the given font size.

Regarding transparent text: Ugh. That is a hack, huh? I've left out support for transparent backgrounds for specifically this reason, but will be investigating a way to do this (universally) post 1.0 as I change the rendering mechansim (as described in the other thread).

avid
July 18th, 2004, 02:15 AM
Welcome back Ben,

Re the font: thanks, I will try that today.

Re the transparency hack: my latest idea (which I probably need for smooth scrolling) is to display the text in front of the button's bitmap (its icon), and if it doesn't have one, then in front of the appropriate rectangle of the parent frame's bitmap.

For scrolling, I will need to do this in my own window class's WM_PAINT handler. So maybe all transparent text can be "scrolling" - just some will be a lot slower than others :-).

The problem is I might not be able to find this bitmap to paint. Do your "draw" methods do anything relevant? I can't figure out what theey do.

My short-term fall-back is that non-scrolling transparent text will use the timer cludge, and scrolling text cannot be transparent.

Brian