How can I reduce the padding on a Dialog? - codenameone

When I press a button, my app displays a calendar (within a Dialog) that slides from the bottom of the screen:
I want the Calendar to occupy the whole width of the screen, but it shows some white padding on both sides and also on the top and bottom (It is white because the "Dialog" UIID has a white created image as background)
I have tried changing all the UIID related to Dialog: "Dialog", "DialogBody", "DialogTitle", etc. I set all margins and paddings to cero.
How can I get rid of that padding?

Try change both the DialogUIID and the UIID of the dialog. Also make sure your calendars margin values are set to zero. It could be that your calendar is too small. Try placing it in a table layout with 1 row and 1 column then in layout constraints set the width and height to 100%

Open up the Component Inspector tool and traverse the hierarchy. You will be able to see all the components and their UIID's within the hierarchy and you should be able to understand which one of those components contributes to the padding/margin.

Related

Apply style regardless of content length of button

I have 2 buttons. say for example a "Browse" button and a "Start Data Backup" Button. I have applied a common style to these buttons. find the buttons below.
As you can see, the content of the browse button aligned properly to the center. But the another one doesn't have any borders. it occupied the button completely. I know it is due to the length of the text and we can fix it by setting the width of the button, but unfortunately i cannot set my button width .because i need my button should give same look with different screen resolution.
What i need now is, the content should be aligned as like in browse button regardless of content length. How to achieve this?
If you have limitation on changing the width of Button for different screen resolutions, instead of changing the width of button try overwriting the font size of the content in button. Also make use of content wrapping to get extra text in new line.

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 - Layout issue

I've a GUI built app and I set many Icon images in the code for some components.
The thing is I've made sure all "padding" and "margin" values are the same for the different states of the components (unselected, pressed, etc) but when I try to input data into the TextFields, it seems like the dimensions of some components change without notice and they completely mess with my layout.
Even sometimes some of the icons partially disappear. Please see the following screenshot of before and after text input, where the Container and TextFields shrink
I really don't know what else I can do. I have tried many things, but stil the same outcome. Please help.
You need to make the container housing all this components scrollable.
Use Millimeters for your TextField padding and margin, don't use Screen Percentage. From the image in the images you posted, 2mm top and bottom and 1mm left and right would be suitable.
If the components having those icons are pressable like a button, be sure to set their pressedIcon to the same icon.
Lastly, style your TextField Unselected state and copy this to Selected and Pressed states, to avoid erroneous styling.

How can I rebuild Form Component in Codename One

I'm trying to create Custom Form configuration with scrollable TitleArea. The Form (black) has a BoxLayout.Y_AXIS Layout in BorderLayout.CENTER (blue). StatusBar (green) stays in BorderLayout.NORTH (green), when rest of the TitleArea (cyan) is in the first position in BoxLayout.
removeComponentFromForm function is unavailable for using in extended class. How can I remove components from Form to removing titleArea from BorderLayout.NORTH?
Why use the title area at all? Why not just add a component to the top of the box layout Y and style it as a Title that way you can scroll it out?
You can also use the new Toolbar API that includes many abilities to fade out the title as you scroll etc. See:
http://www.codenameone.com/blog/toolbar.html
http://www.codenameone.com/blog/cats-in-toolbars.html

Codename One combobox styling

Please, see picture bolow:
I cannot get rid of white paddings/margins in combobox popup. I have two custom containers in designer called DropdownItem and DropdownItemSelected, Fisheye renderer type for ComboBox renderer. As you may see in combobox selected item is displayed just fine. However, in I cannot get combobox popup displayed without white paddings. I have actually used PopupContentPane to add blue border around popup, I also have border set to empty, all margins/paddings set to 0 for following UIIDs: PopupItem, PopupFocus, DropdownItem and DropdownItemSelected. PopupContentPane has also all paddings/margins set to 0. Also see my contants:
I went through source code and cannot find any other useful UIID I can style in order to remove these white paddings. Can someone help me with this?
Update:
Might be helpful - see below how popup looks like when PopupContentPane border sickness is set to 2px:
Update 2:
Almost there. After setting listItemGapInt constant to 0 I managed to remove gaps between list items. See screenshot below.
I still cannot find out how to remove 2 pixel gap on the right and don't know where it's coming from. Would appreciate any thoughts/ideas.
Update 3:
I eventually found where two pixels are coming from.
com.codename1.ui.ComboBox class, lines 289-290
289 int listW = Math.max(getWidth() , l.getPreferredW());
290 listW = Math.min(listW + getUIManager().getLookAndFeel().getVerticalScrollWidth(),
parentForm.getContentPane().getWidth());
In my particular case, listW=630px and in line 290 listW is recalculated as Math.min(630 + 2, 768), where 2px is width of vertical scroll.
As far as can say, scroll bar should be a part ComboBox popup.
I managed to remove unwanted gaps. As I mentioned in 'update 2', listItemGapInt should be set to 0 in order to remove horizontal gaps.
Vertical gap was related to scroll bar however it was not clear that it's a vertical scroll bar that creates that gap. After I set paddings to 0 for Scroll UIID, vertical gap has gone.
In regard to update 3, this is a bug but not because it should be in the container. The list is scrollable so this should be a part of the list however the call should be to l.getSideGap() and not to getVerticalScrollWidth().
This will allow you to hide that by setting the scroll bars to visible false etc. We'll fix that for the next update.

Resources