• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Aligning baseline of NS controls
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Aligning baseline of NS controls


  • Subject: Re: Aligning baseline of NS controls
  • From: Keary Suska <email@hidden>
  • Date: Thu, 10 Jul 2014 08:03:40 -0600

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Aligning baseline of NS controls
      • From: Ken Thomases <email@hidden>
References: 
 >Aligning baseline of NS controls (From: Aandi Inston <email@hidden>)

  • Prev by Date: Re: View-based outline view problem
  • Next by Date: Re: View-based outline view problem
  • Previous by thread: Aligning baseline of NS controls
  • Next by thread: Re: Aligning baseline of NS controls
  • Index(es):
    • Date
    • Thread