Change Stylesheet with Solution Model

Questions and answers for designing and implementing forms in Servoy

Change Stylesheet with Solution Model

Postby hareendra » Mon Mar 17, 2014 8:02 am

Hi,

I have a already created form, which has its own style sheet and a a couple of labels with styles.

I want to change the stylesheet during run-time and assign a new styleclasses (in the new stylesheet) to the two existing labels.
My code is as follows,

Code: Select all
var _success = history.removeForm('frm_myform);
   if(_success) {         
      var _form = solutionModel.getForm('frm_myform');
      _form.styleName = 'new_style';         
      
      var _label1 = _form.getLabel('lbl_1');
      _label1.styleClass = 'lbl_logo_1';   
      
      var _label2 = _form.getLabel('lbl_2');
      _label2.styleClass = 'lbl_logo_2';
}
   


in the new stylesheet (new_style), I have the following styles,
Code: Select all
label.lbl_logo_1
{
   background-image: media:///logo1.png;
   background-color: black;
   width: 2000;
}
label.lbl_logo_2
{
   background-image: media:///logo2.png;
   background-color: black;
   width: 100;
}



However, the result I get is that the labels show nothing. I can see a white space where the labels were.

Any help is much appreciated.

Regards,
Hareendra
hareendra
 
Posts: 98
Joined: Wed Sep 17, 2008 11:41 am

Return to Forms

Who is online

Users browsing this forum: No registered users and 4 guests