Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810
Accepted Solution

custom header field - font question.

Hi all.

 

I am making a custom header field and using screen's 

 

public void setTitle(Field arg0)

 to connect it to my screen.

 

Now the question is how to get the same font that the title would be set on in a Default header field ?

I would like my header to be Theme dependent so I need to set the font dynamically.

 

How can I know which font (+ size, colour and style) is used in Default header fields ?

 

I tried creating a dummy screen and to retrieve its header field information, but it seems that the header field is not created until the screen is actually pushed on top :smileysad:

 

Anyone has a clue ?

 



"Listen carefully, I shall say this only once"
Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: custom header field - font question.

[ Edited ]

Why not use like this?

 

Font f = Font.getDefault();

setFont(f);

 

 Thanks!

 

Message Edited by mantaker on 04-01-2009 01:03 PM
--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: custom header field - font question.

Hmmm...

At first I was a bit suspicious about this simple answer. 

But as it turns out that field actually got the native font family, colour and size. But it did not collect the style.

 

So this is what I had to do:

Font.getDefault().derive(Font.BOLD);

 

Does anyone know how to why simple
Font.getDefault();

 was not enough ?

 

Thanks for the hint mantaker.



"Listen carefully, I shall say this only once"
Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: custom header field - font question.

Font.getDefault() derives the default font which is normally used in TextField, Labels etc.. For headers you need to make the font BOLD, even RIM would've did this for their applications which runs on BB..

 

Thanks! 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: custom header field - font question.

"For headers you need to make the font BOLD"

 

This is a documented fact or an empirically derived rule ?

(I will of course use it, but just wondering .... )

 

Thanks again for the interest and info.



"Listen carefully, I shall say this only once"
Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: custom header field - font question.

[ Edited ]

Its just a sense, not a rule ..

 

Think this way, for a theme, there must be one default font.. Do you agree with that?

 

Well, If yes, then for header field, you want the same default font bolded, for the status bar, you need it to be italisized... This is according to the developer needs ..

 

Still have doubt??

 

Thanks! 

 

Edit: Spelling mistake :smileytongue: 

Message Edited by mantaker on 04-01-2009 04:09 PM
--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group