PDA

View Full Version : [CLOSED] How to dynamically modify ext.net component font-size ?



Tactem
Dec 04, 2012, 4:43 PM
Hi guys,

I want to dynamically modify the font size of controls I use (for example button, panel title, label, tabpanel title ...).
The information of the size is loaded from the database. I'm first trying with the button component

Test.aspx



<style type="text/css">
.small
{
font-size:8px;
}
.average
{
font-size:20px;
}
.big
{
font-size:50px;
}
</style>


<script type="text/javascript" language="javascript">
function Test() {
var b = Ext.getCmp('ButtonLancer');
b.removeCls("big");
b.addCls("small");
}
</script>


<ext:Button runat="server" ID="ButtonLancer" Cls="big" Text="Title 1" TextAlign="Center" Width="400" Height="30">
<Listeners>
<Click Fn="Test" />
</Listeners>
</ext:Button>


Nothing happen to my button font-size.
But if I modify my css by adding .x-btn-inner, it works fine :


.small .x-btn-inner
{
font-size:8px;
}
.average .x-btn-inner
{
font-size:20px;
}
.big .x-btn-inner
{
font-size:50px;
}


Now my questions are : is it the beest way ? how can I do with others controls like panel, label, Treepanel ? Is there a word like x-btn-inner for all of them if yes what are these words ?

RCN
Dec 04, 2012, 10:10 PM
Please wrap all code samples in [CODE] tags.

Forum Guidelines For Posting New Topics (http://forums.ext.net/showthread.php?3440)
More Information Required (http://forums.ext.net/showthread.php?10205)

RCN
Dec 04, 2012, 10:27 PM
Please take a look on the following code:

http://forums.ext.net/showthread.php?4142-CLOSED-Text-align-left-for-button-text&p=16286&viewfull=1#post16286

In my opnion it's better to use Button instead of x-btn-inner


<style type="text/css">
.small BUTTON
{
}
</style>

RCN
Dec 04, 2012, 10:45 PM
Now my questions are : is it the beest way ? how can I do with others controls like panel, label, Treepanel ? Is there a word like x-btn-inner for all of them if yes what are these words ?

Do you want to override font accross entire application?

If this is your case, please take a look on the following post:
http://forums.ext.net/showthread.php?21906-CLOSED-Override-Font-across-entire-application&p=95351&viewfull=1#post95351

Please let me know if you just want to change specific controls

Baidaly
Dec 05, 2012, 2:01 AM
Hello!

Yes, you have to use the second set of CSS rules because this is dictated by button's structure and CSS.

5246

Also, it will be useful to view on @RCN links

Tactem
Dec 05, 2012, 9:21 AM
Do you want to override font accross entire application?

If this is your case, please take a look on the following post:
http://forums.ext.net/showthread.php?21906-CLOSED-Override-Font-across-entire-application&p=95351&viewfull=1#post95351

Please let me know if you just want to change specific controls

Yes RCN this is my case and it seems work fine. I tried with a panel which contains button and tabpanel, and it works fine. Thank you.

Tactem
Dec 05, 2012, 9:25 AM
Please wrap all code samples in [CODE] tags.

Forum Guidelines For Posting New Topics (http://forums.ext.net/showthread.php?3440)
More Information Required (http://forums.ext.net/showthread.php?10205)

Ok RCN I will be careful next time.

Tactem
Dec 05, 2012, 9:26 AM
Thank you to you guys for your support.