How to switch font, i. e. stylesheet on DBTreeView bean?

Hi All

How do I switch the font binding of a DBTreeView bean? As the font information is stored in a column, e. g. the font colum and bound with

bind.setFontTypeDataprovider(‘font’); // Set the dataprovider name to retrieve the node font from

how do I change that for different OSes? I should somehow be able to apply the style to the bean but can’t find a propterty.

Best regards, Robert

what if you use a calculation for the font dataprovider ?

Hello Gabi

You are thinking of a stored calculation, I assume? Good idea, I will try that.

Regards, Robert

Gabi Boros:
what if you use a calculation for the font dataprovider ?

Why a stored one ? You can use an unstored calc for this without problem.

Hi Robert

you mean the bind is not to a table column but directly to a calc? That works?

Regards, Robert

ROCLASI:
Why a stored one ? You can use an unstored calc for this without problem.

If you use the DBTreeView bean (not the new TreeView bean) then you can use unstored calcs yes.

Thanks all of you, this works as you say :-)
Robert, are you saying the dbTreeTableView bean doesn’t support calcs?

I remember someone made a request to be able to set the font color, is that assumption correct?

Regards, Robert

ROCLASI:
If you use the DBTreeView bean (not the new TreeView bean) then you can use unstored calcs yes.

Robert Huber:
Robert, are you saying the dbTreeTableView bean doesn’t support calcs?

No, the DBTreeTableView works just like the DBTreeView. I was talking about the TreeView bean that uses DataSets instead of FoundSets.

Robert Huber:
I remember someone made a request to be able to set the font color, is that assumption correct?

You need to use HTML (again, a calc) for this.

Hope this helps.

Ahh, you ment the (new) TreeView bean.

But where do one have to bind the font color? There seems currently no direct way similar to the font binding, for example, or am I wrong?

Regards, Robert

Hi Robert,

Like I said, you need to use HTML for fontcolor.

<html><font color="#ff0000">Red Text</font></html>

You can use a calc if you don’t want to store HTML in your data.

Hope this helps.

Hi Robert

What I don’t understand is to what method do I have to bind the HTML font color calc?

For the font binding, I use: bind.setFontTypeDataprovider(‘_font’) wher _font is the calc containing for example ‘LucidaGrande, 1, 11’

But I can’t use this method to also bind the color to it, can I?

Regards, Robert

ROCLASI:
Hi Robert,

Like I said, you need to use HTML for fontcolor.

<html><font color="#ff0000">Red Text</font></html>

You can use a calc if you don’t want to store HTML in your data.

Hope this helps.

Hi Robert,

You use the setTextDataprovider() for this. So instead of the normal dataprovider you can use the (unstored) calc for the HTML styled version of some stored text dataprovider.

Hi Robert

I got it to work, it’s a bit tricky, as I have domain (menu) names (id < 100) and “normal” menu names where I want to differentiate the font color and there occured racing problems if 2 switch statements are used for font and names. So what I did for the bind.setFontTypeDataprovider() is a calc:

switch (globals.os)
	{
		...
		case 'Mac OS X':
			if (id < 100)
			{
				nodeName = "<html><p style = 'font-size: 11; color: #444f51; font-weight: bold'>" + name + "</p></html>";
			}
			else
			{
				nodeName = "<html><p style = 'font-size: 11; color: #1c2630; font-weight: regular'>" + name + "</p></html>";
			}
		break;
		...
		return nodeName;

and for the bind.setTextDataprovider():

switch (globals.os)
	{
		...
		case 'Mac OS X':
			nodeFont = 'LucidaGrande, 0, 11';
		...;
		return nodeFont;

I have to set for nodeFont the string ‘LucidaGrande, 0, 11’ incl. weight and size although it’s set in nodeName! But with the string ‘LucidaGrande’ alone it doesn’t work but would be enough as I set weight and size in the nodeName (HTML).

Now, 2 details remain with this solution. If not using HTML, somehow implicit the selected node font gets white which I also would like to have (better looking) and I don’t know how to set the selection background of the selected dn tree node (it’s too dark)

Any idea how to set this 2 properties? See attachment how it looks now.

Thanks, Robert