Again, there are many different ways to do this. It may be useful to break v3 off into a separate class that manages her views, assuring that one (and only one) is always visible.
I also recommend staying away from using the global 'id' attribute where you could get by with locally named instances using the 'name' attribute. Because ids all share the same namespace it's easy to accidentally trample other people's objects if multiple people are involved in your project. Both bringToFront() and using visible will probably perform similarly because invisible views still take time to instantiate. It's possible to tweak when views instantiate, though. Adam blogged about the use of 'initstage' here - http://www.laszlosystems.com/~adam/blog/archives/000027.html On Mon, 28 Nov 2005, Patrick Haggood wrote: > Thanks for the reply. As far as question 2, what's considered > resource-friendly? Should I just include all my pages as invisible, do > with bringToFront (example below) or is there a more recommended method? > > <view name="v2"> > <method name="showpage" args="thepage"> > thepage.bringToFront(); > </view> > </view> > <view name="v3"> > <view id="page1"> > <include href="mypage1.lzx"/> > </view> > <view id="page2"> > <include href="mypage2.lzx"/> > </view> > <view id="page3"> > <include href="mypage3.lzx"/> > </view> > <view id="page4"> > <include href="mypage4.lzx"/> > </view> > </view> > > On Mon, 2005-11-28 at 08:26 -0800, Adam Wolff wrote: > > Here's the easiest way to do that. There are lots of others, including > > using absolute (pixel) positioning or constraints. > > > > <canvas> > > <view> > > <simplelayout axis="y"/> > > <view name="v1"/> > > <view> > > <resizelayout axis="x"/> > > <view name="v2" options="releasetolayout"/> > > <view name="v3" options="releasetolayout"/> > > </view> > > </view> > > </canvas> > > > > > > On Nov 27, Patrick Haggood wrote: > > > > > > > > I wrote a web-service enabled XML backend that I was going to use with > > > XSLT, but found OpenLaszlo and was intrigued by the demos and the > > > AJAX-like rich user interface w/o round-tripping that an XHTML gui would > > > require. However, I'm having a heck of a time figuring out Lazlo's > > > layout rules. > > > > > > I'm trying to produce a web-based app similar to IBM's ETTK navigator > > > (http://awwebx04.alphaworks.ibm.com/ettktechnologies/config/ettk.html) > > > and need to know how to proceed. > > > > > > The layout is like this: > > > > > > [ v1 ] > > > [ v2 ][ v3] > > > > > > V1 is the site's banner, v2 is the main menu, implemented as tabsliders > > > containing (buttons?links?) that call a method that > > > (creates?bringstofront?setVisible?) the selected view in v3. To > > > implement this, I have two questions: > > > > > > 1. Between create, bringtofront and setvisible, which method is most > > > memory friendly and/or responsive? > > > 2. In ????, should I create all views with a common X so they're > > > overlayed with visible=false, then set visible=true, or should I > > > dynamically create the subviews (blogview, albumview, fileview, etc) > > > or ?? > > > > > > > > > Below is a quickie mockup, I've excluded layouts for simplicity. Some > > > syntax may be wrong as I'm writing from memory before running off to > > > church. > > > > > > ========================================== > > > > > > <canvas> > > > <script> > > > var array myviews[]; > > > myview[1] = homeview; > > > myview[2] = blogview; > > > myview[3] = blogview; > > > myview[4] = albumview; > > > myview[5] = fileview; > > > var currentView = myview[1]; > > > showView(1); > > > </script> > > > > > > <method showView args vnum> > > > <!-- hide current --> > > > currentview.setVisible(false); > > > <!-- show new --> > > > currentView = myview[vnum]; > > > <!-- call remote service to populate components --> > > > currentView.doInit(); > > > currentView.setAttribute("visible",true); > > > </method> > > > > > > <view id=v1> > > > <text>My Header</text> > > > </view> > > > > > > <view id=v2> > > > <text>Main Menu</text> > > > <button text="Home" onclick=getView(1)/> > > > <button text="Blogs" onclick=getView(2)/> > > > <button text="Photos" onclick=getView(3)/> > > > <button text="Files" onclick=getView(4)/> > > > </view> > > > > > > <view id=v3> > > > ??????? > > > </view> > > > </canvas> > > > > > > > > > _______________________________________________ > > > Laszlo-user mailing list > > > [email protected] > > > http://www.openlaszlo.org/mailman/listinfo/laszlo-user > > > > > > > > _______________________________________________ > Laszlo-user mailing list > [email protected] > http://www.openlaszlo.org/mailman/listinfo/laszlo-user > _______________________________________________ Laszlo-user mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-user
