[codenameone-discussions] Re: Can't stack custom component in grid layout

2019-10-04 Thread Shai Almog
Grid layout asks components for their preferred size and takes the 
preferred size of the largest components then uses that to construct a 
grid. TableLayout might be more appropriate for your needs.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/eabd1cfa-f403-4806-8a71-e9d3be0e76a0%40googlegroups.com.


[codenameone-discussions] Re: Can't stack custom component in grid layout

2019-10-04 Thread Gareth Murfin
Seems to be caused by the components themselves reporting their own size as 
wrong.. I thought they would report the width and height of the space 
availale to them based on the layout theyre added to.

On Friday, October 4, 2019 at 5:48:52 PM UTC+1, Gareth Murfin wrote:
>
> So I have a grid layout 2x2, and if I add buttons, they stack as expected. 
> For example
>
> myGrid.add(new Button("AAA"));
> myGrid.add(new Button("AAA"));
> myGrid.add(new Button("AAA"));
> myGrid.add(new Button("AAA"));
>
> Adds 4 buttons which sit in each of the cells as expected.
>
> But when I try this with my own custom component (with its own canvas) 
> then they dont stack into each cell, they seem to paint over the top of 
> each other.  ie if I add 4, they all sit in cell 0,0 (painting over the top 
> of each other) which is weird, because I have done this before and it did 
> work perfectly. But I cant work out why.. Hopefully that is explained 
> properly, any ideas what I am doing wrong?
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/dbf9530b-6954-430e-9c5b-63a3c64a18f4%40googlegroups.com.