Index
2012-03-22 12:57 – Paul McNett : [dabo-users] Tip: Justified-alignment of 2 controls in a horizontal dSizer
2012-03-22 13:05 – Ed Leafe : Re: [dabo-users] Tip: Justified-alignment of 2 controls in a horizontal dSizer
2012-03-22 13:13 – Paul McNett : Re: [dabo-users] Tip: Justified-alignment of 2 controls in a horizontal dSizer
2012-03-22 13:38 – John Fabiani : Re: [dabo-users] Tip: Justified-alignment of 2 controls in a horizontal dSizer
Back to top
[dabo-users] Tip: Justified-alignment of 2 controls in a horizontal dSizer

Author: Paul McNett

Posted: 2012-03-22 12:57:59   Link

Over the years, I've had occasional need for laying out a control left-aligned, and

another control right-aligned, in the same horizontal sizer. I know there are lots of

ways to do this but I finally figured out how to do it succinctly with a normal dSizer:

{{{

vs = self.Sizer ## vertical sizer in the form, panel, or whatever

left_control = dabo.ui.dCheckBox(self, Caption="left-aligned")

right_control = dabo.ui.dButton(self, Caption="right-aligned")

hs = dabo.ui.dSizer("h")

hs.append(left_control)

hs.appendSpacer(0, 1) ## proportion=1

hs.append(right_control)

self.Sizer.append(hs, "expand")

}}}

Simply append a horizontal spacer and set its proportion to 1 to tell it to take all

remaining available space. I guess I'd missed that spacers could have proportion set.

Paul

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/4F6B6827.5030903@ulmcnett.com

©2012 Paul McNett
Back to top
Re: [dabo-users] Tip: Justified-alignment of 2 controls in a horizontal dSizer

Author: Ed Leafe

Posted: 2012-03-22 13:05:12   Link

On Mar 22, 2012, at 12:57 PM, Paul McNett wrote:

> Simply append a horizontal spacer and set its proportion to 1 to tell it to take all

> remaining available space. I guess I'd missed that spacers could have proportion set.

What you're doing is pretty much the analogue of this:

http://wiki.dabodev.com/HowToVisuallyFloatAControl

-- Ed Leafe

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/57D7721B-76EE-4F27-968B-E94976B0B38D@leafe.com

©2012 Ed Leafe
Back to top
Re: [dabo-users] Tip: Justified-alignment of 2 controls in a horizontal dSizer

Author: Paul McNett

Posted: 2012-03-22 13:13:28   Link

On 3/22/12 11:05 AM, Ed Leafe wrote:

> On Mar 22, 2012, at 12:57 PM, Paul McNett wrote:

>

>> Simply append a horizontal spacer and set its proportion to 1 to tell it to take all

>> remaining available space. I guess I'd missed that spacers could have proportion set.

>

> What you're doing is pretty much the analogue of this:

>

> http://wiki.dabodev.com/HowToVisuallyFloatAControl

Now that, I can say for certain, I've never had a use for. :)

Paul

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/4F6B6BC8.4040403@ulmcnett.com

©2012 Paul McNett
Back to top
Re: [dabo-users] Tip: Justified-alignment of 2 controls in a horizontal dSizer

Author: John Fabiani

Posted: 2012-03-22 13:38:23   Link

On Thursday, March 22, 2012 01:05:12 PM Ed Leafe wrote:

> On Mar 22, 2012, at 12:57 PM, Paul McNett wrote:

> > Simply append a horizontal spacer and set its proportion to 1 to tell it

> > to take all remaining available space. I guess I'd missed that spacers

> > could have proportion set.

> What you're doing is pretty much the analogue of this:

>

> http://wiki.dabodev.com/HowToVisuallyFloatAControl

>

>

> -- Ed Leafe

The trouble I find the most with sizers is keeping the alignment with many

controls on my forms. I have always like the VFP way - where everything lines

up. Grid sizers work but I often find little issues. I set up the number of

columns to deal with all the labels and textboxes etc.. Then I need something

that does not fit properly in the columns - like I'll need City, State, Zip on

one line but I want the spacing not to match the grid settings. So I add

HSizers that will contact the city textbox, a label "State", state textbox, a

label "Zip" and then the textcontrol. I add spacers and use Column span to

get it into the grid. But things are sometimes just a little off. Maybe only

a pixel or during a resize the zip textbox grows to large. I wish I had a

better setup to control the resizing but I have not found one.

The other issue I have is when I use the grid sizer and then switch to a

different sizer (Normally a Hsizer) the placement of the controls does not

match the grid sizer. IOW's the grid sizer places the label maybe one or two

pixels left or right of the where the HSizer does.

So if someone has a better way to get that alignment - let me know!

Johnf

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/2549833.4pBgqfYFqX@linux-12

©2012 John Fabiani