codenameone autocomplete text field display issue in gui - codenameone

I m working on my mobile apps using codename1 and i found that after adding an autocomplete textfield to any form, every other component disapears along with tabs behind a white container.

It sounds like you are using a scrollable FlowLayout (which is the default layout manager) and some nesting behavior goes bad.
Another guess is that you add everything into the layered pane which is a HUGE MISTAKE, you should add everything to the form directly or content pane.

Related

Display HTML in Boxlayout

I want to display HTML in my forms. The problem is I have to use a Boxlayout to place my components. So when I put a WebBrowser I'll have some height and scroll issues. I get the HTML I want to display from a webservice. The length of the content is variable. I just want to display a part of this response. Here is what I already have:
The webBrowser is below the edit button and ends near the LBL_LIB_NOM label.
As you can see the webBrowser is way too high and I can't scroll the Form when I click over the WebBrowser. In this example I would like to reduce the size of the WebBrowser so we can only see the Title. I also would like if possible to scroll my form when I click on the WebBrowser since I don't want the WebBrowser to scroll.
I have tried a few things to solve my issue:
I tried to override the calcPreferredSize method.
I revalidate my form and my webbrowser.
I resized it's container using the deprecated setPreferedSize method.
In that case the container is well sized but the the WebBrowser displays
above the other components.
The usual answer I have seen in other posts is to put the WebBrowser in a BorderLayout but I can't do that.
So here is my question: Is there any other component I can use to display one HTML line ? Or is there a way to make a webBrowser work properly in a boxLayout ? Do I have to write my own HTML renderer ?
I'm guessing you want box layout so you can scroll... This is problematic.
Web views generally expect to scroll themselves and this is common in native widgets which handle their own events and thus scrolling. It's hard for our code to know when your swipe is intended for us or to the underlying native widget and it's harder still to do this in a consistently portable way.
There are 3 options:
Use only Codename One code
Use a border layout or similar layout
Use the web browser for the entire UI of this form
If you want to take the first option this article might be useful as a starting point.

No transition on first form

I am using a CN1 project created by the CN1 plugin in IntelliJ. I have built a form by hand (not using the GUI builder). I would like the first form shown to be my form. Unfortunately, it seems to bootstrap code that loads the theme expects me to use a form created in the GUI builder. In fact, when my application loads, it briefly shows the default Hello World screen, and then transitions to my form by scrolling the form from right to left. How do I make my hand-coded form the first thing on the screen appear without any transition?
It would seem that I could just override StateMachine.getFirstFormName(), but my form is not known to the underlying code.
There are many ways to do this... Try creating a new project with Get Started template selected.
Open MyApplication.java or any other name you changed MyApplication to. Replace the hi form code and use this as your code foundation.

Using a Custom Form as Hamburger SideMenu on Codename One

I have seen the Codename One Video on how to create a Codename One Hamburger Side Menu using Commands.
I have been trying to see if I can do that on a button click instead (my forms have title bars turned off, i use a border layout and create my own title bar by placing it in the North), with probably another from as the side menu. I would like to have an image and then a custom menu display on my Side Menu instead of the regular Codename One buttons.
Has anyone tried something similar?
I suggest you take a look at the Toolbar class which is more powerful and would probably alleviate the need to override the title area:
http://codenameone.com/manual/components.html#_toolbar
http://www.codenameone.com/blog/cats-in-toolbars
You can't set a form at the side menu but you can add arbitrary components into it which should be enough. Again the Toolbar API makes this rather simple.

How do you get ActionBar from SocialBoo theme to show up in your GUI?

Ok. Starting over with this. I see that the SocialBoo theme has something similar in what I want to achieve. If I find that I can work and improve. I Added a new socialboo theme and created blank GUI. Assumed it would be a Commandbehavior but that didnt do the trick, so did adding tabs. Seems like those components are not for that specific bar... However did notice another issue.
How do I get the social actionbar as displayed in the socialboo theme? (Screen shot). Assuming those images etc are part of the default theme, right.
Also, If I create a TouchCommand = bar, title or native. It displays fine in Gingerbread but not ICS. DO you know why is that? (screen shot)
Thanks, in advance.
Those images aren't a part of the theme, they are a part of the specific demo. If you add a Tabs component to the center of the border layout UI you will get thee tabs where the "icon" property will allow you to customize the unselected icon and you can customize the selected icon as well. You can see the full source/resource file of the social boo demo in the docs and demos zip in the download section.
Generally customizing commands is a bit complex because of platform specific constraints, when running on an Actual Android 4 device we use the native ActionBar by default to provide the experience Android users are used to. This is hard for us to simulate so you will only see this properly in the device build. I suggest not relying on commands, it seems that what you are trying to achieve is easily doable with tabs and its possible that's why you had difficulties in your other question.

Making a basic navigation for iOS with two buttons on both sides of the title

I am working on codenameone, and trying to make the first UI.
A basic UI with a title and two buttons on two sides of the "title" to go to two different pages.
I was trying to do that with "Form" component but then it only gives one button by default, which is just taking me to the previous screen.
Not sure how to do this, any link or tip is a nice help.
thanks
Use addCommand(new Command("X")) or in the GUI builder just click the commands property in the form. It will automatically use the menu for Android.
The back button is added automatically for iOS apps for back navigation which you will probably need. You can disable it in the state machine code and have room for two commands in the title.

Resources