B4J Question Combobox and ADP background color

udg

Expert
Licensed User
Longtime User
Hi all,

which items I've to set in order to have a Combobox and an AnotherDatePicker components share the same #BEBFBF background color all the TextFields, TextAreas and ListViews sport? TIA.

I tried the obvious: Background Properties (internal designer) and CssUtils module (SetBackgroundColor and SetStyleProperty). Tried even cbTest.Style=.. but all showed a darker grey than what desidered.

Note: it's ok to load a dedicated CSS file on program startup.
 

udg

Expert
Licensed User
Longtime User
Sure. Please find attached two images.
First one shows a form's section as it appears on my notebook, while the second one shows how I set the combobox properties relative to the background color.

#BEBFBF is a very light grey while both ADP and ComboBox show a darker one. Maybe it is caused by something in the default CSS loaded at program start up.

udg
 

Attachments

  • Backgrounds1.PNG
    Backgrounds1.PNG
    3.9 KB · Views: 237
  • ComboBoxProp.PNG
    ComboBoxProp.PNG
    8.9 KB · Views: 270
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I don't see any difference:

SS-2017-03-14_10.05.12.png


B4X:
Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   MainForm.RootPane.LoadLayout("1") 'Load the layout file.
   MainForm.Show
   CSSUtils.SetBackgroundColor(MainForm.RootPane, fx.Colors.From32Bit(0xFFBEBFBF))
End Sub

There is a light shade over the combobox but the colors are very similar.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Hi Erel, you're right.
I checked #BEBFBF on https://www.w3schools.com/colors/colors_picker.asp and it shows the same "darker grey" that my ComboBox shows.
What it is wrong is the color used by all the other components (mainly TextFields) that looks a lot lighter than #BEBFBF.
A good approximation of the lighter grey is #F1F2F2.
So, setting #FFBEBFBF as the Color item in the Backgroud Properties section of a TextField (Internal designer) the resulting color on my video is very close to the one resulting from setting #FFF1F2F2 for the same item on a ComboBox.
Please find a screenshot that shows the effect of using both BEBFBF (TextFileds) and F1F2F2 (ComboBox and ADP).

udg
ps: in a way my original problem is solved, although I can't figure out why I needed to use two different colors.
 

Attachments

  • Background_2.PNG
    Background_2.PNG
    3.9 KB · Views: 244
Upvote 0

udg

Expert
Licensed User
Longtime User
Just to better show what happens, I created a small project that you may find attached here.
You will see two panels made up of the same components; the one on the left is almost good while the one on the right is what I come up with if I set the properties as I think I should (i.e. using #BEBFBF as background color for every item)

Note: in order to have the desidered background color for the ADP component I had to add two lines in its Create sub; if you uncomment those lines you end up with a background color different from the one set in ADP property.

Anyway, the real question is why TextFields and TextAreas look so light-grey when set to BEBFBF?

Thanks for your attention.
 

Attachments

  • bgtest.zip
    8.9 KB · Views: 236
Upvote 0

udg

Expert
Licensed User
Longtime User
I had previously downloaded Caspian; now I am reading Modena although I'm not an CSS expert.

Anyway, I would expect that setting ColorDrawable.Color property would suffice to obtain the right color and unfortunately that seems not the case.
Have a look at my final attachment. It shows TextFields set to #BEBFBF , Combobox to #F1F2F2 (both by Internal designer) and ADP to #BEBFBF through its Style property (-fx-base: #BEBFBF) and they all differ from your screenshot from post #4 above.

As already said, it's not a big problem since I found a way to circumvent it, but I feel it could eventually help others if they will ever run in a similar situation (and if they use the SEARCH function..ehehe).

udg
 

Attachments

  • Final.PNG
    Final.PNG
    17.3 KB · Views: 228
Upvote 0
Top