I'm developing an app, i chose the flat orange theme but the tittlecommand isn't visible, just appears if I slide to the right and it appears
I checked the theme.res in the titlecommand unselected item but it seems ok
if I click on it nothing happens, only when I slide it to the right
How could I make the tittle command appears when it is unselected?
--------------------------------------------------------------------
UPDATE 01/15/2020
The container appears with width=0 and height=0.
But how could I change it.
The code of the slide menu is
Style s = UIManager.getInstance().getComponentStyle("TitleCommand");
FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_TITLE, s);
Image logo = res.getImage("index.jpg");
Container topBar = BorderLayout.west(new Label(logo));
topBar.add(BorderLayout.SOUTH,new Label("Los del Camino","SidemenuTagline"));
getToolbar().addCommandToLeftBar("",icon,null);
getToolbar().addComponentToSideMenu(topBar);
getToolbar().addMaterialCommandToSideMenu("Inicio",FontImage.MATERIAL_HOME, e -> new Hola().show());
getToolbar().addMaterialCommandToSideMenu("Estudios",FontImage.MATERIAL_BOOK, e -> {} );
getToolbar().addMaterialCommandToSideMenu("Calendario", FontImage.MATERIAL_CALENDAR_TODAY, e -> new Calendario(res).show());
getToolbar().addMaterialCommandToSideMenu("Documentos", FontImage.MATERIAL_FILE_PRESENT, e -> {});
getToolbar().addComponentToSideMenu(new Label(" ", "SideCommand"));
getToolbar().addMaterialCommandToSideMenu("ACERCA DE", FontImage.MATERIAL_LIVE_HELP , e -> {});
Related
providing this to scroll , then click on the element which text value i am declared in description
AndroidElement quot=(AndroidElement)driver.findElementById("com.mrk.compaq.application:id/divider21");
MobileElement list = (MobileElement) driver.findElement(
MobileBy.AndroidUIAutomator(
"new UiScrollable(new UiSelector()).scrollIntoView("
+"new UiSelector().description(\"*Enter UTR No.*\"));"));
System.out.println(list.getLocation());
//list.click();
but the result is its scrolling up and down but not able to click on the element .
Your click line is commented out.
Uncomment it: //list.click(); -> list.click();
I'm trying to develop a side menu with a sliding home screen when I open the menu. The issue I have is when I close the side menu, the menu button disappear .
enter image description here
Form hi = new Form("Hi World");
Toolbar tb = new Toolbar(false);
Image icon = theme.getImage("icon.png");
Container topBar = new Container(new BorderLayout());
topBar.add(BorderLayout.SOUTH, new Label("Cool App Tagline...", "SidemenuTagline"));
topBar.setUIID("SideCommand");
Command SideLogoCommand = new Command("");
SideLogoCommand.setIcon(icon);
Command MenuCommand = new Command("");
Button HomeCommand= new Button("Home");
HomeCommand.getAllStyles().setFgColor(0xA6A6A6);
HomeCommand.addActionListener((evt) -> {
SideMenuBar.closeCurrentMenu();
});
Button WebsiteCommand= new Button("Website");
WebsiteCommand.getAllStyles().setFgColor(0xA6A6A6);
Button SettingsCommand= new Button("Settings");
SettingsCommand.getAllStyles().setFgColor(0xA6A6A6);
Container cnt = new Container(new BoxLayout(BoxLayout.Y_AXIS));
cnt.add(topBar);
cnt.add(HomeCommand);
cnt.add(WebsiteCommand);
cnt.add(SettingsCommand);
hi.setToolbar(tb);
tb.setOnTopSideMenu(false);
hi.addCommand(SideLogoCommand);
MenuCommand.putClientProperty("SideComponent", cnt);
tb.addCommandToSideMenu(MenuCommand);
hi.addComponent(new Label("Hi World"));
hi.show();
I'm guessing it's because of this line:
tb.setOnTopSideMenu(false);
You're essentially forcing the older less tested side menu that might still have regressions in newer code. The best thing to do is remove that line. But if you insist you can try invoking:
hi.setAllowEnableLayoutOnPaint(true);
Notice this will impact performance for long forms etc.
In my code I have a scrollable container, I want to call a refresh function when the user pulls down on the container.
venueList = new Container(BoxLayout.y());
venueList.setScrollableY(true);
venueList.addPullToRefresh(() -> {
refresh();
});
This works well when there is more then one item in the container, however, when there is only one item or less, this does not work.
The issue occurs both on the NetBeans simulator and on my ios device.
My current workaround is to add a button to the list if it is empty (after calling a web-service) named "REFRESH", with the refresh() function invoked on clicking it.
Update I just tried this with tabs too with the same result:
Form hi = new Form("Hi World", new BorderLayout());
Tabs t = new Tabs();
Container mainContainer = new Container(BoxLayout.y());
mainContainer.setScrollableY(true);
mainContainer.addPullToRefresh(() -> log("Pull..."));
t.addTab("Test Tabs", mainContainer);
hi.add(CENTER, t);
hi.show();
Original answer below:
This worked fine for me with no elements so I'm guessing there is a different issue such as placing the container within a nested scrollable hierarchy:
Form hi = new Form("Hi World", new BorderLayout());
Container mainContainer = new Container(BoxLayout.y());
mainContainer.setScrollableY(true);
mainContainer.addPullToRefresh(() -> log("Pull..."));
hi.add(CENTER, mainContainer);
hi.show();
#Shai, thank you for pointing me in the right direction, it indeed ended up being a nesting issue.
When I was adding my list container to the Tab container I was using the following code:
tabContainer.addTab("Around Me",aroundTabicon,BoxLayout.encloseY(venueList));
Note that the BoxLayout.encloseY was causing the issue, I removed it and ended up with the following:
tabContainer.addTab("Around Me",aroundTabicon,venueList);
And it seems to be working now.... thank you again.
I am using fontImages in codename one to the Toolbar. So our requirement is to set name below to that Font Images.
Something like this:
Command cmd = toolbar.addMaterialCommandToRightSide("Name", FontImage.MATERIAL_INFO, e -> {});
Button b = toolbar.findCommandComponent(cmd);
b.setTextPosition(Component.BOTTOM);
we want dialog message in this format and look and fill
Can you please let me know how to resolve it. My application needs to be supported on all platforms (Android, iOS, Windows) and I don't want to write native code for all platforms separately.
Actually customizing the look is easier in Codename One as everything is written in Java you can customize literally everything about the look of anything.
For simplicity sake I used code rather than styles which would be better, you can customize the Dialog UIID and other UIID's in the theme designer to get more flexibility and have this easier. However, this would require many screenshots and explanations so I did the customization in code:
Form f = new Form("Test");
Button b = new Button("Show Dialog");
f.add(b);
b.addActionListener(e -> {
Dialog dlg = new Dialog("Authentication");
Style dlgStyle = dlg.getDialogStyle();
dlgStyle.setBorder(Border.createEmpty());
dlgStyle.setBgTransparency(255);
dlgStyle.setBgColor(0xffffff);
Label title = dlg.getTitleComponent();
title.setIcon(finalDuke.scaledHeight(title.getPreferredH()));
title.getUnselectedStyle().setFgColor(0xff);
title.getUnselectedStyle().setAlignment(Component.LEFT);
dlg.setLayout(BoxLayout.y());
Label blueLabel = new Label();
blueLabel.setShowEvenIfBlank(true);
blueLabel.getUnselectedStyle().setBgColor(0xff);
blueLabel.getUnselectedStyle().setPadding(1, 1, 1, 1);
blueLabel.getUnselectedStyle().setPaddingUnit(Style.UNIT_TYPE_PIXELS);
dlg.add(blueLabel);
TextArea ta = new TextArea("This is the text you want to appear in the dialog, this might line break if the text is too long...");
ta.setEditable(false);
ta.setUIID("DialogBody");
ta.getAllStyles().setFgColor(0);
dlg.add(ta);
Label grayLabel = new Label();
grayLabel.setShowEvenIfBlank(true);
grayLabel.getUnselectedStyle().setBgColor(0xcccccc);
grayLabel.getUnselectedStyle().setPadding(1, 1, 1, 1);
grayLabel.getUnselectedStyle().setPaddingUnit(Style.UNIT_TYPE_PIXELS);
dlg.add(grayLabel);
Button ok = new Button(new Command("OK"));
ok.getAllStyles().setBorder(Border.createEmpty());
ok.getAllStyles().setFgColor(0);
dlg.add(ok);
dlg.showDialog();
});
f.show();
I would recommend doing the dialog customization in the theme designer and using a 9-piece image border which is better looking.