Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Button title/text color

    SmartGWT Version : 2.2
    Browser Version : Chrome 5.0
    TLDR : How is one to change only the text color of a Button?

    I am evaluating SmartGWT for a medium sized project and have
    encountered a simple issue. I would be very grateful for any
    help in advancing past this issue. I have searched the forums but
    have not found any post or mention of this issue specifically.


    I have included a .CSS file into the HTML containing this class :
    Code:
            .helloTitle{
            	color: red;
            }
    The textcolor of the title of a button appears to be read-only.
    I took the sample code from the showcase for a button :
    Code:
            final Button cssButton = new Button("CSS Button");  
            cssButton.setShowRollOver(true);  
            cssButton.setShowDisabled(true);  
            cssButton.setShowFocused(false);
            cssButton.setShowDown(true);
    I attempt to apply the CSS class to the button in this manner, but it has no effect.
    Code:
            cssButton.setTitleStyle("helloTitle");
    Then I attempt this, but it has no effect.
    Code:
            cssButton.setStyleName("helloTitle");
    Then I attempt this, but it has no effect.
    Code:
            cssButton.addStyleName("helloTitle");
    Then I attempt this which does affect the Button element, but removes the theme/skin - which is the default theme/skin that ships with SmartGwt.
    Code:
            cssButton.setBaseStyle("helloTitle");
    How is one to change only the text color of a Button?

    Much thanks,

    - Matthew

    #2
    AFAIK your baseStyle must include the other attributes of the default ('button') style

    Comment


      #3
      Applying 2 CSS class names to a baseStyle via setBaseStyle does not seem to work either. Consider with the same CSS class, 'helloTitle' from original post ;

      Code:
      button.setBaseStyle("button helloTitle");
      In the HTML source it is apparent that both CSS class names have been output, however the red-text is not visible.

      Any suggestions?
      I do not want to remove the CSS file from the theme-jar.

      Thank you,

      -Matthew

      Comment


        #4
        ?
        why remove the css file?
        include in your 'helloTitle' baseStyle all the attributes of the default ('button') style, not only the 'color' attribute.

        Comment

        Working...
        X