Re: Vertically-expanding NSTextField
Re: Vertically-expanding NSTextField
- Subject: Re: Vertically-expanding NSTextField
- From: Andrew Bowman <email@hidden>
- Date: Tue, 20 Jun 2006 03:37:30 -0700
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