Use elaborated structures

54 views
Skip to first unread message

Anass Jdid

unread,
Dec 4, 2017, 6:27:31 PM12/4/17
to CodenameOne Discussions
Hi,
I want to know what is the best
Way to place buttons or labels on an elaborate structure.
Is it by using coordinate layout.

Shai Almog

unread,
Dec 5, 2017, 12:19:38 AM12/5/17
to CodenameOne Discussions
Hi,
since Container is a Component you can nest containers within components to create any elaborate structure you want.
You can also use the new GUI builder which works in a more "free form" style of layout.

If you have a UI layout you can't reproduce just post a screenshot of what you are trying to build and we'll try to explain the layout nesting.

Anass Jdid

unread,
Dec 5, 2017, 3:59:56 AM12/5/17
to CodenameOne Discussions
I m trying to build a dental schema. As in the image attached
32-teeth-9620958.jpg

steve nganga

unread,
Dec 5, 2017, 4:43:29 AM12/5/17
to codenameone...@googlegroups.com
This looks more like problems which can be attacked by Graphics... The is  sample clock in the developers guide which should give you good pointers, you could just get the right images and draw them on the canvas

On Dec 5, 2017 11:59, "Anass Jdid" <anass...@gmail.com> wrote:
I m trying to build a dental schema. As in the image attached

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/eef26c01-0195-4f91-ba52-1de58d7602b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anass Jdid

unread,
Dec 5, 2017, 5:44:38 AM12/5/17
to CodenameOne Discussions
Yes, but i wander if i can use a layered layout to put a button on every tooth

Shai Almog

unread,
Dec 6, 2017, 12:16:21 AM12/6/17
to CodenameOne Discussions
Personally I would build a custom layout manager for this and just use components. You can style a button to look like a tooth and then enjoy all the benefits of working with components.
There is a sample of creating your own layout manager in the developer guide and I recently did something for maps too: https://www.codenameone.com/blog/tip-map-layout-manager.html

You can also use the GUI builder and layered layout to position things, I'm not sure which of the two options would be less challenging.

If I would build a layout manager I'd just determine the position/size of each tooth in a virtual coordinate space and then scale the coordinates based on the layout (internally that's roughly how layered layout works) but you can simplify this a lot by making the constraints the actual tooth name when you add the component.

Anass Jdid

unread,
Dec 6, 2017, 7:02:56 AM12/6/17
to CodenameOne Discussions
I might even use tableLayout and play with passing values to get a spherical structure
Thanks for all your responses

Anass Jdid

unread,
Dec 6, 2017, 7:04:16 AM12/6/17
to CodenameOne Discussions
... padding values ...

Shai Almog

unread,
Dec 7, 2017, 12:12:11 AM12/7/17
to CodenameOne Discussions
That's a good idea. I would suggest using align top/bottom in the table layout constraint (respectively) as the default is scale which might not work nicely for the padding values.

Anass Jdid

unread,
Dec 7, 2017, 8:40:27 AM12/7/17
to CodenameOne Discussions
Will do thanks
Reply all
Reply to author
Forward
0 new messages