On Wed, Jul 2, 2008 at 12:43 PM, Paul McNett <[EMAIL PROTECTED]> wrote: > Ed Leafe wrote: >> On Jul 2, 2008, at 12:45 PM, johnf wrote: >> >>> Where gs is a grid sizer. >>> gs.append(dabo.ui.dLabel(self,Caption='City',Alignment='right')) >>> >>> Shouldn't alignment right cause the text of the label to be on the >>> right side >>> of the gridsizer column? It is not doing what I would have >>> expected. The >>> text is left. >> >> You're specifying the alignment within the label itself. You seem to >> want the label to align within the grid sizer. >> >> BTW, the practice of writing the object creation inside the sizer >> append() is prone to confusing mistakes like this. If you had written >> it as two steps: >> >> lbl = dabo.ui.dLabel(self,Caption='City',Alignment='right') >> gs.append(lbl) >> >> your mistake would have been more obvious. The correct way to align >> the label in the grid sizer would be: >> >> lbl = dabo.ui.dLabel(self, Caption="City") >> gs.append(lbl, halign="right") > > And to help with the concept a little, the label *was* right-aligned, > within the bounds of the label. They label and sizer was smart enough to > allocate just enough width to the label to show the caption. So your > right-aligned label showed that way, but the label was left-aligned in > the sizer.
The label has a property called AutoResize that resizes it just enough to fit the caption. You can still size the label manually if you want to... A case where you would use the Alignment property in the label itself: You have 9 fields and want to divide them into 2 dBorderSizer for the sake of looks, but you want the labels from each Sizer to line up with each other. _______________________________________________ Post Messages to: [email protected] 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/[EMAIL PROTECTED]
