Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 10762 invoked from network); 18 Mar 2011 08:48:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Mar 2011 08:48:24 -0000 Received: (qmail 10628 invoked by uid 500); 18 Mar 2011 08:48:24 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 10581 invoked by uid 500); 18 Mar 2011 08:48:23 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 10572 invoked by uid 99); 18 Mar 2011 08:48:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2011 08:48:23 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of noelgrandin@gmail.com designates 74.125.82.182 as permitted sender) Received: from [74.125.82.182] (HELO mail-wy0-f182.google.com) (74.125.82.182) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2011 08:48:15 +0000 Received: by wyf23 with SMTP id 23so3858197wyf.13 for ; Fri, 18 Mar 2011 01:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=vh6YGHdzXpVYDqremFJ9XM50sCmQpz7kgHr07izuDC8=; b=LlbCSNoA4vrfkw8O4say6iGI+Bnf/Ut0KxE4f65EnE2y9U3KdocJJ17ODhRrl9/l71 bEh9w0VzPxrfSDhfakI8LAEFLhFfcp39XXBW8FJrwiZsaFS0U6kHvvgwKDmzxVS5uT9o PuqVirrxyaV1kiVSkgN/GL5Ck6werQMqfe7hw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=MWEmr7S5Z0VGqwj7Z8bGyAQdfDQGbyd8eiTG96hGxThOAW/67s5zmf2nrkSlAWNpsV lAlRdM7A/1vZgCuF3So8UFmDYk97aA/wLipDA1KUesuegbKe5nl1jQNYI9F3Uf3deH3Y SCzqTGPbVIShxnmxkpIg1Glm0J5AfkKqAwWCo= Received: by 10.216.9.199 with SMTP id 49mr2193412wet.45.1300438073594; Fri, 18 Mar 2011 01:47:53 -0700 (PDT) Received: from [192.168.1.243] (196-210-242-115.dynamic.isadsl.co.za [196.210.242.115]) by mx.google.com with ESMTPS id p5sm1200263wbg.45.2011.03.18.01.47.50 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 Mar 2011 01:47:52 -0700 (PDT) Message-ID: <4D831C36.6000308@gmail.com> Date: Fri, 18 Mar 2011 10:47:50 +0200 From: Noel Grandin User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051201 Thunderbird/1.5 Mnenhy/0.7.3.0 MIME-Version: 1.0 To: user@pivot.apache.org CC: Bill van Melle , Greg Brown Subject: Re: The patchwork that is Pivot layout References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi If we focus on the use-case at hand, I can see two things that could be improved in Pivot. BoxPane --------------- I think part of the problem here is just the way BoxPane works. At the moment, the "fill" style of BoxPane is doing double duty. It means two things for a vertical boxpane (1) make the component fill the available width if the component is smaller than the boxpane width (2) if the components preferred width is greater than the available width, cut off the component. I'm not sure about the rationale for doing (2) - Greg, can you remember why we do that? Either way, it would be beneficial for split (1) and (2) into separate styles. Border ------------- Border could do with having alignment and fill styles, which is a fairly straightforward change and would make this class more useful. Regards, Noel. Bill van Melle wrote: > Has there been any thought to regularizing the patchwork of layout properties in Pivot? I'll say more about what I > mean below, but first an example that prompts my message, my nth frustrating instance of "figuring out how to do > layout in bxml": > > Suppose I want to display a photo centered in a pane, and put a paragraph of text under it. I want the photo to > display in a 150x150 square, no matter what its original size or shape was: > > > preferredWidth="150" preferredHeight="150" > styles="{fill:true, horizontalAlignment:'center'}" /> > > > So far, so good. Now I decide I'd like the photo to have a nice border around it, so I try: > > > > preferredWidth="150" preferredHeight="150" > styles="{fill:true}" /> > > > > This fails two ways: Border doesn't have a horizontalAlignment style, and the fill:true on the BoxPane (needed in > order for the text to wrap), results in the preferredWidth being ignored (whether I put it on the ImageView or on the > Border). So I end up wrapping the whole thing in another non-filled BoxPane: > > > > styles="{color:'gray', thickness:4, cornerRadii:10}"> > > > > > > Bleah. And now suppose I want to put a button centered below the text. Buttons don't have a horizontalAlignment, > either, and the BoxPane's fill style would make it grotesquely wide anyway, so I have to do the same BoxPane trick > with it: > > ... > > > > ... > > Am I missing something? Is there an easier way? > > This is an area where WPF seems much more organized to me. Instead of Pivot's incomplete set of choices of which > components have alignment properties, and how you specify that a component should fill the available space, *all* > visual components have HorizontalAlignment and VerticalAlignment properties. The possible values are Left (Top), > Center, Right (Bottom), and Stretch. Stretch is the default, and says that the component should consume all the space > given by its parent in the indicated dimension. See http://msdn.microsoft.com/en-us/library/ms751709.aspx for more. > > So the WPF for this example is simply > > > Height="150" Width="150" RadiusX="10" RadiusY="10" > HorizontalAlignment="Center" /> > >