|
Replies:
3
-
Last Post:
Nov 20, 2008 9:43 PM
by: Shai Almog
|
|
|
|
|
|
|
z-ordering
Posted:
Sep 11, 2008 10:06 PM
|
|
|
|
|
Sorry to keep bugging you 
When the LWUIT source was released it was announced that z-ordering was supported.
I was wondering how this was achieved and if some basic sample was available. In what kind of Layout Manager is this supported ? (can I use it in a BorderLAyout for example ? )
I'm trying to have a small menu sliding on top of a component located in a BorderLayout.CENTER. The problem is I have NO idea on how to add it to the CENTER of the BorderLayout with a z-index superior to the one of the other component.
Any help appreciated
Thanks again for your help ( and patience ^^)
Cheers
Alex [att1.html]
|
|
|
|
|
|
|
Re: z-ordering
Posted:
Sep 11, 2008 10:41 PM
in response to: Alex
|
|
|
|
|
Hi, its possible that what you want is really glass pane support (see the blog for more on that). For z-ordering you need to install a layout manager that returns true for isOverlapSupported(), you can derive border layout to return true there but you would need the layout to somehow position the component in an overlapping manner... Currently only CoordinateLayout returns true for osOverlapSupported().
The order of adding the components to the container determines their z-order, you can insert a new component at a fixed index to change that.
Other than that things should work as usual.
> Sorry to keep bugging you  > > When the LWUIT source was released it was announced that z-ordering > was supported. > > I was wondering how this was achieved and if some basic sample was > available. > In what kind of Layout Manager is this supported ? (can I use it in > a BorderLAyout for example ? ) > > I'm trying to have a small menu sliding on top of a component > located in a BorderLayout.CENTER. The problem is I have NO idea on > how to add it to the CENTER of the BorderLayout with a z-index > superior to the one of the other component. > > Any help appreciated > > Thanks again for your help ( and patience ^^) > > Cheers > > Alex > >
Shai Almog http://lwuit.blogspot.com/
[att1.html]
|
|
|
|
|
|
|
|
Re: z-ordering
Posted:
Nov 20, 2008 9:09 PM
in response to: Shai Almog
|
|
|
Shai,
Could you elaborate a little but more on CoordinateLayout.isOverlapSupported() or point us to more documentation on how to achieve z-ordering please ? Can it be used to z-Order existing Components, e.g. a Label on top of an RGBImage or a TextField on top of a List ?
Thanks in advance !
|
|
|
|
|
|
|
|
Re: z-ordering
Posted:
Nov 20, 2008 9:43 PM
in response to: drdth
|
|
|
|
|
Chen is the bigger expert on this subject since he implemented that... Generally z-ordering costs, which is why it is not on by default for other layout managers. It wouldn't make sense for the current layout managers either since they don't allow overlapping anyway. isOverlapSupported allows a layout to indicate it supports z- ordering, so you can derive BorderLayout and make all elements "peek" then return true from is overlap supported and everything will work as you expect... Since isOverlapSupported returns false by default z- ordering is "cost free" if you don't use it.
z-order is defined by the order of the components within the container, we now allow inserting a component in a specific index allowing it to be on top/bellow another component. Last is top if I recall correctly.
CoordinateLayout allows you to place component almost absolutely which is a common use case for z-ordering. Almost, since this is rarely what we want.
Say you have a 320x320 device and you create a 320x320 coordinate layout and place a button in 160 - buttonHeight / 2x160-buttonWidth / 2 What you "really" want to do is place the button in the center of the screen. Problem is that even in the standard 320x320 device, the title & softbutton areas will take up space which will change on the fly based on themes padding, margin and font. Not to mention lower resolution devices...
Coordinate layout "scales" abstract coordinates to "real" coordinates as decided by the layout managers so even if the layout has 160x160 resolution it will still place the component in the center of the screen appropriately.
> Shai, > > Could you elaborate a little but more on > CoordinateLayout.isOverlapSupported() or point us to more > documentation on how to achieve z-ordering please ? Can it be used > to z-Order existing Components, e.g. a Label on top of an RGBImage > or a TextField on top of a List ? > > Thanks in advance ! > [Message sent by forum member 'drdth' (drdth)] > > http://forums.java.net/jive/thread.jspa?messageID=318019 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net > For additional commands, e-mail: users-help@lwuit.dev.java.net >
Shai Almog http://lwuit.blogspot.com/
[att1.html]
|
|
|
|
|