B4J Question css question

Discussion in 'B4J Questions' started by ivanomonti, Apr 4, 2018.

  1. ivanomonti

    ivanomonti Well-Known Member Licensed User

    è possibile impostare css anche per le sezioni dell'oggetto in questione?

    is it possible to set css also for the sections of the object in question?

    Code:
    Sub css_button(obj As Button)
        CSSUtils.SetStyleProperty (obj,
    "-fx-base"," #222222")
        CSSUtils.SetStyleProperty (obj,
    "-fx-control-inner-background","#222222")
        CSSUtils.SetStyleProperty (obj,
    "-fx-background-color","#222222")
        CSSUtils.SetStyleProperty (obj,
    "-fx-table-cell-border-color"," transparent")
        CSSUtils.SetStyleProperty (obj,
    "-fx-table-header-border-color"," transparent")
        CSSUtils.SetStyleProperty (obj,
    "-fx-padding","5")
        CSSUtils.SetStyleProperty (obj,
    "-fx-font-size","10pt")
        CSSUtils.SetStyleProperty (obj,
    "-fx-text-fill","#7D7D7D")
        CSSUtils.SetStyleProperty (obj,
    "-fx-border-width","0")
        CSSUtils.SetStyleProperty (obj,
    "-fx-background-radius","0")
        CSSUtils.SetStyleProperty (obj,
    "-fx-background-insets","0 0 0 0, 0, 1, 2")
    End Sub
    Error code

    Code:
    CSSUtils.SetStyleProperty (obj,".button:hover:-fx-background-color"," #3a3a3a")
    CSSUtils.SetStyleProperty (obj,
    ".button:pressed, .button:default: hover:pressed -fx-background-color: white;-fx-text-fill"," #1d1d1d")
     
  2. Eme Fibonacci

    Eme Fibonacci Well-Known Member Licensed User

    Why you don't use style sheets and selector id?

    Code:
    'MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "style.css"))

    Sub css_button(obj As Button)
            obj.Id=
    "btnstyle1"
    End Sub
    style.css
    HTML:
    #btnstyle1 {-fx-control-inner-background: "#222222";}
    #btnstyle1 {-fx-background-color: "#222222";}
    #btnstyle1 {-fx-table-cell-border-color: "transparent";}
    #btnstyle1 {-fx-table-header-border-color: "transparent";}
    #btnstyle1 {-fx-padding: 5;}
    #btnstyle1 {-fx-font-size: 10pt;}
    #btnstyle1 {-fx-text-fill: "#7D7D7D";}
    #btnstyle1 {-fx-border-width: 0;}
    #btnstyle1 {-fx-background-radius: 0;}
    #btnstyle1 {-fx-background-insets: 0 0 0 0,0, 1,2;}
    #btnstyle1:hover {-fx-background-color: "#3a3a3a"}
    #btnstyle1:pressed {-fx-background-color: white; -fx-text-fill: "#1d1d1d"}
     
    Last edited: Apr 4, 2018
  3. Erel

    Erel Administrator Staff Member Licensed User

    No. The style of classes must be set in the CSS file. Once you do it you will see that it is very simple.
     
  4. ivanomonti

    ivanomonti Well-Known Member Licensed User

    I would like to do an inner class for personal management, it is not possible so you are telling me!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice