Page 1 of 1

User control of text size

Posted: Sun Oct 06, 2013 7:35 pm
by lohill
I would like to give the user control over the size of the text in the various controls of my application. The controls I want them to be able to manipulate are specifically: text fields, data grids and revBrowser instances. I would like something controlled by a menu items activated by Cmnd '+' and Cmnd '-' than would work for those controls if they are present.

For the revBrowser controls I can use 'RevBrowserMakeTextBigger' and 'RevBrowserMakeTextSmaller. They should be no problem. For text fields I can use a combination of 'get the effective textSize' and 'set the textSize' which is a bit more complicated.

What can I use for data grids. Are there any tricks that will help me with those?

Thanks for ant suggestions,

Larry

Re: User control of text size

Posted: Mon Oct 07, 2013 12:35 am
by dunbarx
As far as digging around DG's for a while as taught me. the fields in them that display the actual data are all in groups named, for example, "Col 1" or Col 2". There are a lot of groups in a DG, and you have to be careful about which ones you are dealing with.

Anyway, you can always set the textSize of the fields themselves:

Code: Select all

set the textsize of fld "Col 1 002" to "36"
or you can set the textsize of the column groups they are in

Code: Select all

set the textSize of grp "Col 1" to "36"
You would have to loop through these fields or groups, composing the object references explicitly as you go, to set them all. Of course you can set the size of the title group or others as well, if you want to.

Craig Newman

Re: User control of text size

Posted: Mon Oct 07, 2013 12:54 am
by lohill
Thanks Craig,

I gather this means there is no easy way like with revBrowser. I really like data grids but maybe that is asking too much of them.

Larry

Re: User control of text size

Posted: Mon Oct 07, 2013 2:41 am
by dunbarx
Larry.

But this is really not so bad, is it? A custom command can do whatever you need. Once written, it can be socked away somewhere, and you just call it when you need it. It will set the textSize of the whole thing, any column, any single field or any explicitly designated number of them. Piece of cake.

Craig

Re: User control of text size

Posted: Mon Oct 07, 2013 6:02 pm
by lohill
Craig,

I tested your suggestion with a simple data grid of three rows and three columns.
'set the textsize of grp "Col 2" of group "DataGrid 1 " to 36' gave me the error: 'Chunk: can't find background, char 21'

I am having more success with combinations of:
set the dgProp["Text Size"] of group "DataGrid 1" to 36
set the dgProp["Row Height"] of group "DataGrid 1" to 50 (or some suitable value)

I still need to figure out what the relationship is between text size and row height that looks natural. This method seems simple enough.

Larry

Re: User control of text size

Posted: Mon Oct 07, 2013 7:56 pm
by dunbarx
Hi.

You have a typo:

set the textsize of grp "Col 2" of group "DataGrid 1 " to 36' (cannot have a single quote after the 36)

Otherwise this works. But the dgText thing for the whole shebang is something I forgot about. Good thinking.

Craig