01-25-2013 11:37 AM
Hello.
I have a blackberry 10 cascades app with code as below.
How would I get the button to fill the whole screen? I would have thought the code below would do the trick but it doesnt. The button expands horizontally to fill the width of the parent, but vertically the buttn just stays at the top of the screen the same as if I hadnt called setVerticalAlignment() at all.
Any ideas? Maybe this is a bug?
Thanks very much in Advance.
//-----------------------------------------
Page *Pg = new Page();
Button* Butt = new Button();
Butt->setText("well");
Butt->setHorizontalAlignment(HorizontalAlignment:
Butt->setVerticalAlignment(VerticalAlignment::Fil
Pg->setContent(Butt);
Application::instance()->setScene(Pg);
Solved! Go to Solution.
01-25-2013 11:45 AM
01-26-2013 08:06 PM
Thanks for the helpful reply.
This wouldnt seem very unreasonable. However if I instead call
Butt->setVerticalAlignment(VerticalAlignment::Cent
I would expect the button centered vertically on the screen of the device. Wouldnt you (or am I missing something)?
It doesnt, however. It just sits at the top of the screen no matter what I pass to setVerticalAlignment() (same as if I dont call it at all).
01-26-2013 08:32 PM
01-26-2013 08:37 PM
Thanks very much.
Yes, youre right, Im experimenting.
Im quite used to programming Qt, but am new to Cascades.
Once you know the things your just explained everything is fine, but its hard to "figure it out" just by readingthe documentation, because it sems to be quite sparse on "this is the way containers and pages etc work together" type of info :-)
Ill "experiment" some more with using your advice and hopefully "orientate" myself better.
Thanks again.
01-26-2013 08:56 PM
Just for reference (in case anyone else is interested) code which would work is below.
Thanks again peter9477
//------------------------------------------------
Page *Pg = new Page();
Container *Cont = new Container();
Button* Butt = new Button(Cont);
Butt->setText("well");
Butt->setHorizontalAlignment(HorizontalAlignment:
Butt->setVerticalAlignment(VerticalAlignment::Cen
Cont->setLayout(DockLayout::create());
Cont->setTopPadding(20.0f);
Cont->setBackground(Color::fromARGB(0xff00f800));
Pg->setContent(Cont);
Application::instance()->setScene(Pg);