Re: Vertically-expanding NSTextField
Re: Vertically-expanding NSTextField
- Subject: Re: Vertically-expanding NSTextField
- From: Sebastian Morsch <email@hidden>
- Date: Thu, 29 Jun 2006 09:52:48 +0200
Dear Andrew,
sorry for not being more specific on the reasons for why I started
working on a new solution for all this. Your class definitely works
great and changes views above and below (and super) very nicely.
The only thing I wasn't able to add to your class was the
functionality to move views that sit left or right of the textfield
(such as a label for the field) along with the *top border* of the
textfield. When IFVerticallyExpandingTextField resizes on typing,
views next to it stick with it's bottom border (of course, because
the textfields height is increased, etc..).
So I thought "I need means to tell views to stick (link) with each
others borders" like it is done in a graphical layout of text. A way
of defining a layout the views will maintain no matter of their size.
Then other things would be possible too, like having a textfield
expand horizontally on typing, pushing away other controls on the
right, etc...
I don't like Address Book's "Raised Editor" that's why I'm working on
an alternative "form ui", where several textfields (and possibly
other controls such as popup buttons) are layouted inside a scroll
view with the ability to always adapt to the size of their content
while maintaining their defined layout. I uploaded two pics to
illustrate that:
http://homepage.mac.com/sebastianmorsch/misc/DetailEditorEditMode.jpg
http://homepage.mac.com/sebastianmorsch/misc/DetailEditorLockedMode.jpg
So that's what I ment with "wasn't your goal". I admit that my
approach is quite complicated and unfortunately it doesn't work so
well yet. So I'm double curious about your (and everyone elses)
opinion on this!
Kind regards,
Sebastian
Am 20.06.2006 um 12:37 schrieb Andrew Bowman:
Hey Sebastian,
On Jun 18, 2006, at 9:02 AM, Sebastian Morsch wrote:
Dear Andrew,
I was reading this thread because I was looking for a solution for
many views to rearrange in interaction to each other. For example,
one textfields gets bigger because the user types in something and
two other textfields below move downwards accordingly to make room
for it.
Thank you for your code on cocoadev, it was very helpful to write
the automatically expanding textfield! But still I couldn't get
other views to react and move around (which of course wasn't your
goal at all).
This actually was one of the goals of my expanding textfield, and
my casual testing found this to work fine. The relevant method
here is "alterAutoresizeMasksForViews: surroundingView:". This
method should be able to tell if sibling views are above or below
the expanding field, and should adjust the autoresizing masks so
that the views move as expected during expansion (such as your
example with the textfields).
Could you give me some more detail on the views that aren't
reacting properly, and the way you're expecting them to act? If my
code's broken somewhere I'd really like to fix it up.
So I wrote this protocol to define a system with the following
behaviour: "if a view changes frame, it will rearrange other views
to maintain defined distances between the borders".
The implementation works quite nicely. HOWEVER, this code is
veeeery ruff and newbieish, not very well tested and most probably
not very elegant. I decided to post it anyway for those who like
it and especially for those who don't like it and maybe would like
to improve it. I apologize for the code length! As I said, it
still lacks elegancy and needs improvement.
If someone thinks, that this should go into another or it's own
thread, please let me know!
Thanks!
Sebastian
// START OF SMViewLinking.h
Looks interesting, but a little complex, I'll need to set aside a
little time to go through this. It appears like you're having
views link themselves to the autosizing view. When I started my
expanding textfield I began with this approach too, but decided to
look around for a more elegant solution, as this required code
changes to accompany interface changes.
The code in the method I mentioned above should do the job without
needing any kind of registration. You can also check out Kurt
Revis's Disclosable View code at www.snoize.com, as I used some of
his code for this solution.
Just making sure, did you test your interface in IB to ensure the
autoresize settings were correct on all of your views? A mistake
here may make it seem as if my expanding field isn't working. If
everything looks fine to you, I'd appreciate any additional info on
this issue.
If anyone else on the list cares to comment on their experiences
and/or bugs encountered with IFVerticallyExpandingTextField, I'd
really appreciate it.
- Andrew Bowman
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden