On Jul 10, 2014, at 2:02 AM, Aandi Inston wrote:

> I am porting a library for dynamic dialog creation to Cocoa.
> The implementation is using various standard controls such as
> NSTextField and NSButton. I have a question.
> 
> Suppose a dialog is to contain a line with multiple controls like
> 
> [ ] Add ________ seconds [before/after]
> 
> Here
> [ ] Add  is a check box
> _____  is an editable text field
> seconds  is a noneditable text field
> [before/after]  is a popup button
> 
> Each of these controls contains text, and the aim here is to align the text
> so it does not jump up and down - to align the text baseline. If the top of
> the controls, or the bottom of the controls, are aligned then the text
> itself will not be aligned.
> 
> Two possibilities suggest themselves
> - fixed constants, based on experiments (which will perhaps go awry if the
> system configuration changes)
> - work out the height of each of these controls, assume padding is equal
> top and bottom, and adjust alignment by half of the difference (this is an
> attractive idea, but I note in a single experiment that the height of
> noneditable text was 16 while editable text was 21, a difference of 2.5
> pixels which is awkward).
> 
> Is there a better way to do this? I imagine it's a problem faced before.

Umm, Auto Layout? You can easily align elements by baseline...

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to