How to change selected tab background in codenameone? - codenameone

I'm doing sample on Tabs and its working fine but here my question how to show differentiate between selected and non selected Tabs in codenameone. it means after selecting Tab i want to show different background color.
how can i achieve this?

Change the background color of the selected state of Tab Uiid in your Codename One Designer.

Related

TreeItem of material-ui to be focused by right-clicking

Please teach me how to control the background color when right-clicking on TreeView/TreeItem.
Based on https://codesandbox.io/s/jggxz?file=/demo.tsx which is linked from https://material-ui.com/components/tree-view/ ,
in the case of implementing the context menu function, the background color of the right-clicked item is not as expected.
Let me explain how it works by watching the attached video.
Right-click on "Forums" to bring up the context menu.
Then, for a brief moment, "Forums" will get the focus and the background color will change to pink.
After the background color disappears, the context menu will appear.
Also, up to this point, the background color of "Promotions", which was selected from the beginning, is always green.
What I want is the following. What should I do to make it look like the following?
Right-click on "Forums" to bring up the context menu.
Then the background color of the right-clicked item "Forums" will change to green, and
at the same time, the background color of the selected "Promotions" from the beginning will disappear.
Another thing I tried was to use TreeView's "selected" props and useState, but it did not work as expected.
That version is below.
https://codesandbox.io/s/material-demo-forked-h5z8e?file=/demo.tsx

Trouble changing background color of TextField in Codename One

I just started building my first App with Codename One and I'm having quite some trouble. :-)
I cant change the background color of a TextField, I changed everything in the Theme and named it "TextField". At the Color tab I changed the background color and set Transparency to 255. Since the Component is named TextField, shouldnt the style be applied automatically when I make a new TextField?
I also tried to set the UIID manually to "TextField", which didn't help either.
Am I missing something?
Kind regards,
Max
The way backgrounds work in Codename One is this:
Border is applied first
Then image
Then gradient
Then color
TextField and other components such as Button etc. often have a default border derived from the theme.
Switch to the Border tab, click derive then click the ... button and select empty.

How to resize material-ui's tabs

I am trying to get a result looking like this (picture taken from https://material.google.com/components/tabs.html#tabs-usage):
I don't want the tabs to take 100% of the width of the page, as it is by default with material-ui. Is it possible to do this with the implementation of material-ui ? I already played with the width of each tab using the style tab property, but the inkbare seems hardcoded to use percentages according to the id of the selected tab, and therefore doesn't underline properly the resized tabs. Is there a workaround?
There is an issue related to this problem https://github.com/callemall/material-ui/issues/1203
But yes, there is an easy workaround. (unfortunately it doesnt support diffrent widths across the tabs).
You can use the Tabs tabItemContainerStyle property to set the width of the tabs container (make it the width you want to each tab times the number of tabs).
Since the background color is setted on that element, you're gonna need to override the styles for two others Tabs properties (style and contentContainerStyle).
In this example Im setting the same color as my tabs in the style property (for the whole component) and setting the contentContainerStyle back to a white background.
You could use the classes properties as well..
Ex: (Imagine you have a blue toolbar)
<Tabs
tabItemContainerStyle={{width: '400px'}}
style={{background: 'blue'}}
contentContainerStyle={{background: '#FFF'}} >

Codename one Blue theme checkboxes in BoxLayout

I am using the CodenameOne blue theme ('shipped with' CodenameOne). I added checkboxes to a BoxLayout.Y container. When selecting one of the checkboxes, the checkbox is getting smaller and wider. I looked in the theme but I can't find out why.
Tested on Android 4.4
I added two images to show what happens. In the first, METAR was checked (and unchecked I guess), in the second, TAF was checked.
After checking another one, the size of the checkbox selected before is normal again.
There are 4 different state selected,unselected , pressed and disabled . And all styles of checkbox can be viewed in theme and as the screenshot there is blank in pressed and disabled style so generate the styles from theme.

How to change the BarButtonItem back color?

I am currently working in the C# windows application with DevExpress controls.
Now I want to change back color of bar button item while loading the form.
I've tried following code:
barButton.Appearance.BackColor = Color.Red;
but the bar button back color not changed to red.
By default, bars use the skins to draw their content. In this case, all background colors are provided by specific skin elements, which cannot be changed. The only way to change a specific item's background color is to disable skins:
put the BarAndDockingController component onto a form, and assign it to the BarManager.Controller property. Set BarAndDockingController.PaintStyleName or LookAndFeel to any non-skin style(for example "Flat"). Then use the Bar.Appearance.BackColor property to set the desired color.
Alternatively, you can create your own custom barItem in a way similar to the one described in the How to change the background color of highlighted links KB article.

Resources