OK this seems to work even thought it uses a depreciated method (is there 
anything better than setPrefferedHeight?), BUT still the form in the 
background does not move along X, why is that?

Toolbar tb = f.getToolbar();
        int height=Display.getInstance().getDisplayHeight()/8;
        
        Container gaz = new Container();
        GridLayout grid = new GridLayout(8,2);        
        gaz.setLayout(grid);

        for (int i=0; i<16; i++)
        {
             Button test = new Button("ZZZZZ");
             test.setPreferredH(height);
             gaz.add(test);
        }
       tb.addComponentToSideMenu(gaz);

And still when I move this to my main project my initial problem returns, 
gaps to left, right, top and buttom.... must be theme related? Sorry for 
all the posts here Ive been posting as I go along!..

https://www.dropbox.com/s/yamvq1wgoer4zfo/Untitled-5%20copy.jpg?dl=0


On Tuesday, January 15, 2019 at 2:06:16 AM UTC+8, Gareth Murfin wrote:
>
> So I started a fresh project to test this out, completely fresh, the only 
> code I use is
>
>  Toolbar tb = f.getToolbar();
>      Container IncludeSideBar = (Container) createContainer(r, "SIDEA");  
>       
>      tb.addComponentToSideMenu(IncludeSideBar);
>
> still 2 issues,
>
> 1-when menu comes out it does not push the screen behind along the x 
> coordinate, so you cant see the hamburger button anymore (in your tutorial 
> you can see it) - is this meant to happen?
>
> 2- when you add a container it doesnt seem to respect the height of the 
> screen, so if I use a gridlayout (3,3) and add 9 buttons, in the editor 
> they fill the available space, but on the simulator they do not, they are 
> all at the top of the screen, this happens even if I use this code to try 
> get it to use all the space:
>
>  IncludeSideBar.setWidth(Display.getInstance().getDisplayWidth()/2);
>         
>  IncludeSideBar.setHeight((Display.getInstance().getDisplayHeight()));
>
> Screenshot shows both problems: 
> https://www.dropbox.com/s/2f9i6kl1fb287qh/Snap%202019-01-15%20at%2001.44.38.png?dl=0
>
>
> I then tried your demo project from here 
> https://github.com/codenameone/ToolbarSidemenu
>
> this doesnt open as a cn1 project so wont compile. Same happens with the 
> kitchen sink demo. Im just looking for a demo somewhere that uses a 
> container on the side menu and slides out and works (ie screen behind moves 
> along x axis as it should, and containers layout & height are respected). 
>
> Any help would be much appreciated, making a nice side menu should be very 
> easy these days. When following your tutorial through and doing it by code 
> etc, it does work as expected (form behind scrolls along x and menu looks 
> good) BUT this is done by code, I want to add a container from gui builder, 
> OR failing that do my layout in code but it needs to respect the height of 
> the container, since as you can see in my screenshot the client wants 8 
> buttons which take up equal space and fill the entire height of the 
> screen... is this possible?
>
> I guess my main issue is this:
>
> For example, why does the container "gaz" here not get its height set to 
> 600? here when I add it to the toolbar:
>
> Container gaz = new Container();
>         GridLayout grid = new GridLayout(3,3);        
>         gaz.setLayout(grid);
>         gaz.setHeight(600);
>         gaz.add(new Button("TEST"));
>          gaz.add(new Button("TEST"));
>           gaz.add(new Button("TEST"));
>            gaz.add(new Button("TEST"));
>             gaz.add(new Button("TEST"));
>              gaz.add(new Button("TEST"));
>               gaz.add(new Button("TEST"));
>                gaz.add(new Button("TEST"));
>                 gaz.add(new Button("TEST"));
>                 tb.addComponentToSideMenu(gaz);
>
> Thanks... I hope it can do this or client will have to change their 
> designs.
>
>
> On Tuesday, January 15, 2019 at 12:00:20 AM UTC+8, Gareth Murfin wrote:
>>
>> I want to use the cool slide out side menu with a container Ive built 
>> (basically something like your gorgeous sidemenu tutorial but with a 
>> container ive built). But I have a couple of issues:
>>
>> So I have made the menu using
>>
>> Toolbar tb = f.getToolbar();
>> tb.setHidden(true); // i want to use my own custom made top bar so hide 
>> default one
>> Container IncludeSideBar = (Container) createContainer(r, 
>> "IncludeSideBar");
>> tb.addComponentToSideMenu(IncludeSideBar);
>>
>> So far so good, but when I open the menu it appears very strange, see 
>> screenshot. It only shows 3 entries (I can scroll down to see others) and 
>> doesnt fill the full height of the screen (leaving gaps at top and bottom) 
>> and leaves a gap on the left too. How can I make it appear more like the 
>> design I have shown in my screenshot? 
>>
>>
>> https://www.dropbox.com/s/jxrcu9q7gl8pfsl/Snap%202019-01-14%20at%2023.56.21.png?dl=0
>>
>>
>>

-- 
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.
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/16b2e682-9fb2-4921-8519-d2ef957fb4fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to