B4J Question How can color of menu bar change?

Discussion in 'B4J Questions' started by thader2012, Jul 29, 2015.

  1. thader2012

    thader2012 Member Licensed User

    Hi all,

    Its wonderfull the new version 3.5 of B4J, but i have got any question. How can color of menu bar change? In the previous version I use style css as -fx-text-fill, but now i prove this style in the internal designer but it isnt running.


    Any suggestions for this problem, thanks for your help.
     
  2. rwblinn

    rwblinn Well-Known Member Licensed User

    Hi,

    have you tried in the Visual Designer to change for the control MenuBar the value of the Color under Drawable ColorDrawable as part of the Background Properties,
    Have tested by changing the value to #FFF0F312 and works fine.

    upload_2015-7-29_21-38-52.png
     
  3. thader2012

    thader2012 Member Licensed User

    Thanks, but I talk about the color of text, no background color. With css, using -fx-text-fill, I can change the color of text in the bar menu. Now it isnt runing, How can I do this?
    Thanks.
     
  4. rwblinn

    rwblinn Well-Known Member Licensed User

    OK - Then try:

    Create in the Project Files Folder a CSS file (like Main.css) with content (example red text):

    Code:
    .menu .label {
      -fx-text-fill: red;
    }
    In B4J code set the MainForm style - this style applies to all controls:
    Code:
    MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "Main.css"))
    #NOTE
    The CSS File Main.css can also include other settings.
     
    ellpopeb4a likes this.
  5. thader2012

    thader2012 Member Licensed User

    Thanks rwblinn for your answer. Its running ok, I was thinking that i can write -fx-text-fill: red; in EXTRA CSS option of internal designer, but this idea isnt running.

    Thank you
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Extra CSS goes to Node.Style. It doesn't support classes.
     
  7. thader2012

    thader2012 Member Licensed User

    Oh! thanks Erel I dont know it.
     
  8. rwblinn

    rwblinn Well-Known Member Licensed User

    Hi,

    would post a new thread as this is a new question.
    As the titlebar is linked to the OS color settings it seems not possible to change. Look here as one of the many answers.
    An option is to set the formstyle to undecorated and build your own titlebar.

    ... but may be one of the experts have a trick at hand ;)
     
    tdocs2 likes this.
  9. tdocs2

    tdocs2 Well-Known Member Licensed User

    Thank you, Rob.

    I did set the question as a new thread.

    I have also experimented with the Win 10 Control Panel Personalization. Like everyone else, I found out that there is no option to just change the color of the title bar.

    Best regards.

    Sandy
     
Loading...