CodenameOne - Dropdown List Design (FAQ Style) - codenameone

Hi,
I am trying to achieve a similar screen to the one attached here using codename one. Its such that when a question is clicked, the answer drops down beneath it. The text would also have proper line breaks as it fills the screen width.
Is there any component I can use in achieving this using codename one?

I would suggest using the Tree component and setting the icons to null explicitly. This should work reasonably well for something like that and include the animation etc.

Related

How to implement an intelligent drag drop (like this) in react? Canvas or non-canvas based approach?

What approach to do intelligent drag drop like this in react? (canvas or non-canvas based approach?). That is to use React (with a library such as React DND) without using cavas, OR move to rendering/drawing this within React using HTML 5 "canvas" (with potentially a library such as "react-konva".
Requirements:
when dragging the item, the other items behind "move" to calculate
and show what the final re-arrangement will look like (if the drag is
allowable)
may be drop points for which move is not allowed so would highlight
this as well (e.g. if some other items in the timeline were "locked")
I have checked React DND, react-konva, and others. The issue they use the transform property and that prevents moving the placeholder separately from dragging the item.
So here is the custom implementation: https://codesandbox.io/s/drag-swap-qv6s0x
P.S
It is still unfinished (buggy), later I will fix and clean up the code. But for now, I would like to share it, to know is it what you wanted or if I missing something.
Have a look at this online documentation for MDBootstrap:
https://mdbootstrap.com/docs/standard/plugins/drag-and-drop/
Go to "Horizontal example" section, this might be what you are looking for.
Edit: Sadly this is a premium feature :(

How to structure the CN1 code for a tablet form layout?

I've been building my Codename One app for the phone screen format so far. There is a separate Form for the main menu, then a second Form with a list of elements, and then a third Form to edit an element selected from the list. Each Form has an overflow menu and various Titlebar command buttons. And each (Extended) Form has a lot of code that implements the functions in the Form and shares variables etc.
However, to use the tablet (iPad) screen estate, I would like to show the main menu on the left of the screen, the list of elements in the middle and the element edit form on the right. Something similar to the screenshot below. This seems to be a common type of layout on tablets and suits my app usage pattern well.
However, I don't see an elegant way of structuring the code to do this. I can't easily combine the list and edit Forms into one Form, and writing a completely new Form just for the tablet format would be a lot of work. I assume others have faced the same challenge and would love to hear how you achieved this.
PS. I know the side menu can be made permanent but that only solves part of the problem, not how to show a list and edit Forms at the same time.
There is no one answer for this but if you look at apps like Codename One Build you would notice they adapt to this form factor.
We usually just use isTablet() to adapt the UI at key points to the different form factor. One element is the permanent side menu which we turn on in the init method using code like this:
if(Display.getInstance().isTablet()) {
Toolbar.setPermanentSideMenu(true);
}
It makes the side menu stay open all the time. Within the code we try to use Container instead of Form. This allows us to package multiple logical pieces into a single UI for the tablet mode.

How can I modify Sencha Ext.form.HtmlEditor behavior?

I'm using sencha 3.4.
I'm trying to add functionality to the HtmlEditor buttons
https://docs.sencha.com/extjs/3.4.0/#!/api/Ext.form.HtmlEditor
To be more specific:
I want to change the text direction with the text alignment buttons.
At the moment, those buttons are only changing the text alignment and not it's direction.
Thanks.
I could achieve basic reverse with overriding execCmd method of Ext.form.HtmlEditor. But still i think it only takes one button for reversing the text (instead of both left and right justifiers).
Here's the FIDDLE
Eventually, I've added two new buttons for this functionality.

Codenameone Detect keyboard showing

Is there a way to add a listener on the Form for when the virtual keyboard shows or dissapears in Codenameone?
The reason is because I want to detect this and recalculate the size of the Form. Currently, the sizeChangedListener does not get called when the keyboard shows, and so some components are hidden from view, as I can't recalculate the sizes of the components.
See Display.getInstance().setVirtualKeyboardListener(...)
You shouldn't do that.
Keyboards resize the UI only on Android and don't have that affect on iOS/Windows. We will probably change that behavior on Android as well so relying on it in that way doesn't make sense.
Size changed is called on the form when running on Android otherwise basic stuff wouldn't work. Notice that you shouldn't rely on it for typical code, if you use scrollable containers properly and the right layout things should automatically rearrange themselves correctly.
I suggest rephrasing the question with a sample of your UI/layout and problems including screenshots. E.g. a common issue is placing a text field within a non-scrollable container so the resize logic can't do anything and it fails by making the text disappear.

How can I create personalized menus in WPF?

I'm working on an XmlEditor (similar to XmlNotepad, but using WPF) in which I want to implement personalized menus. I.e. only show the most popular MenuItems on first open, and show all MenuItems when the user explicitly asks for it, either by clicking on the double arrow at the bottom or waiting for a certain amount of time.
I'm specifically looking for feedback on how I should approach this problem: any thoughts are appreciated!
Since you're working on an XmlEditor. It will be a problem for this case. Try using a different editor.

Resources