Codename one scrollbar coming back - codenameone

Scrollbar coming back when I send new Android build. I was add this code to hide scrollbar and everything fine, I didn't change anything.
UIManager.getInstance().setLookAndFeel(new DefaultLookAndFeel(UIManager.getInstance()) {
#Override
public void bind(Component cmp) {
if (cmp instanceof Container) {
cmp.setScrollVisible(false);
}
}
});

I'm not sure why this fails but a better approach would be defining the theme constant scrollVisibleBool=false.

Related

Styling command in onTop side menu

What we do in commnads in older side menu is that we put the "uiid" in putClientProperty() method but it doesn't work in ontop side menu. How to style it?
Command services = new Command(" Services", servicesIcon) {
#Override
public void actionPerformed(ActionEvent evt) {
}
};
f.getToolbar().addCommandToSideMenu(services);
services.putClientProperty("uiid", "commandProp");
It still works but because the side menu is constructed eagerly instead of lazily you don't see this.
Instead of this:
f.getToolbar().addCommandToSideMenu(services);
services.putClientProperty("uiid", "commandProp");
Do:
services.putClientProperty("uiid", "commandProp");
f.getToolbar().addCommandToSideMenu(services);

Side Menu stopped working after new update

I have an app that has a nice side menu that comes from the left, after today's update it is completely empty when it slides out and I have no idea why.
here is how I show it,
SideMenuBar smb = (SideMenuBar) Display.getInstance().getCurrent().getMenuBar();
smb.openMenu(null);
Here is how it is created (remember this worked perfectly until today when I updated libs):
private void addSideMenuToLeft(Form f)
{
_("addSideMenuToLeft");
//make a toolbarForLeftMenu so we can use its sidemenu (we can only have one on the left!)
if (toolbarForLeftMenu==null)
{
toolbarForLeftMenu = new Toolbar();
}
toolbarForLeftMenu.setHidden(true);
f.setToolbar(toolbarForLeftMenu);
if (SideMenuLEFT==null) //otherwise it keeps adding each time
{
SideMenuLEFT = (Container)this.createContainer(resources, "SideMenuLEFT");
SideMenuLEFT.setWidth(Display.getInstance().getDisplayWidth()/2);
SideMenuLEFT.setHeight((Display.getInstance().getDisplayHeight()));
SideMenuLEFT.setUIID("SideNavigationPanel");//so we get the nice background.
toolbarForLeftMenu.setUIID("Container");
toolbarForLeftMenu.addComponentToSideMenu(SideMenuLEFT);
//make each button live, there are 2 buttons the icon and the words, for each one
Button btCategory = (Button) Tools.findByNameX("btCategory", SideMenuLEFT,sm );
btCategory.addActionListener(new ActionListener(){
#Override
public void actionPerformed(ActionEvent evt) {
}
});
_("made left menu");
}
}
We deprecated the SideMenuBar and replaced it with the new on-top side menu. It was announced multiple times and discussed quite a bit.
To disable this and use the "old" functionality you can use:
Toolbar.setOnTopSideMenu(false);

Cefsharp - display page loading indication

I'm implemeting a win form which contains a cefsharp chromium-embedded browser.
I'm facing the following problem - sometimes it takes time until a page is loaded.
The problem is that user has no idea that something happens until the page is actually loaded.
I have no control on the pages that the browser displays.
I need to display some kind of loading indication. I searched the web and the only thing that I found was to show an animated loading image while the loading takes place and hide it when the page is loaded (using the load state changed event).
It seems to make things even slower.
Is there anything in Cefsharp infrastructure that I can use? or any other idea of solving it?
Thanks!
ChromeView = new CefSharp.Wpf.ChromiumWebBrowser();
//Adding event listener
ChromeView.NavStateChanged += ChromeView_NavStateChanged;
//Event listener
private void ChromeView_NavStateChanged(object sender, CefSharp.NavStateChangedEventArgs e)
{
if(!e.IsLoading)
{
this.Dispatcher.Invoke(()=> { //Invoke UI Thread
controller.setLoaderinBack(); //UI Update
});
}
else
{
this.Dispatcher.Invoke(() => { //Invoke UI Thread
controller.setLoaderinFront(); //UI Update
});
}
}
For Higher Versions of CefSharp (mine version 81):
ChromeView = new CefSharp.Wpf.ChromiumWebBrowser();
//Adding event listener
ChromeView.LoadingStateChanged += ChromeView_NavStateChanged;
//Event listener
private void ChromeView_NavStateChanged(object sender, LoadingStateChangedEventArgs e)
{
if(!e.IsLoading)
{
//Stuff...
}
else
{
//Stuff...
}
}

Why Doesn't My Component Appear On Top of The HTML Page Or Media Player In Codename One

I've used a media player and I'm trying to do rendering on top of it with progress indication or buttons but the code isn't working.
E.g.:
findInfiniteProgress().setVisible(true);
Timer timer = new Timer();
TimerTask timerTask = new TimerTask() {
#Override
public void run() {
Display.getInstance().callSerially(new Runnable() {
#Override
public void run() {
if(findMediaPlayer().getMedia() != null && findMediaPlayer().getMedia().isPlaying()){
findInfiniteProgress(f).setVisible(false);
}else{
findInfiniteProgress(f).setVisible(true);
}
}
});
}
};
Codename One uses lightweight rendering which means all components are drawn in sequence on a single thread. Native widgets (peers) need to be drawn on the native thread and are always drawn on top, that is the secret to Codname Ones portability explained here.
Common peers in Codename One include: Web browser, media playback & native maps.
The workaround is to use Dialog which is effectively a separate Form so the current peer doesn't really render underneath.

codename one remove back button on ios

I removed the title of the form because I don't want it. when I did that, a back button on the iOS(On android back button does not show) started to show on the bottom of the form.
I've tried to override showForm() in the StateMachine and invoke setTitle("") but the back button is still there.
#Override
public Form showForm(String resourceName, Command sourceCommand) {
Form f = super.showForm(resourceName, sourceCommand);
f.setTitle("");
return f;
};
Is there a way to remove that back button?
That's not the way. Override allowBackTo as:
protected boolean allowBackTo(String formName) {
return false;
}

Resources