Re: Programmatically loading an NSImage via other field
Re: Programmatically loading an NSImage via other field
- Subject: Re: Programmatically loading an NSImage via other field
- From: email@hidden
- Date: Thu, 04 Dec 2008 14:37:23 -0500
Namaste!
Back so soon...
:)
OK, I took a look a what you have and have some questions.
And, well, hmmmm...
I'M A DOPE!! :D
No questions!
The reason for that is I was under the extremely mistaken impression
that I couldn't load the ImageView from a simple path via a binding.
I took a look at how you had your ImageView bound and voila! The
answer was staring me straight in the face! ROFL!!!
Can I say "OMFG?"
Geez...
But I did learn some things along the way so it wasn't a total loss...
I now return you back to your regularly scheduled program...
THANKS!!!
Peace, Love, and Light,
/s/ Jon C. Munson II
p.s. Isn't it always something simple???
Quoting Matt Long <email@hidden>:
Jon,
I'm not sure I understand the whole problem here, but from your initial
message I put together a simple demo project that will take the input
value from a text field and use that as the path for an NSImageView. It
does it on the fly (e.g. as you type). Here is the demo project:
http://www.cimgf.com/files/AutoImageLoad.zip
On first run, use the "Browse..." button to locate an image and select
it. The image will display. Then start to backspace from the end of the
path in the text field and you'll see the image you selected
disappears. Then type back in what you backspaced out and you'll see it
reappear. This is all done with the magic of bindings. The text field
value and the image view's value path are both bound to the same
string. When the string gets updated, so do both of those fields.
You'll see the string that is being used for this is a @property of my
AppDelegate class.
Let me know if you have further questions. I'm a former Windows guy
myself and can probably help you unlearn what you "know" as I also had
to do. ;-)
Best Regards,
-Matt
On Dec 4, 2008, at 10:03 AM, email@hidden wrote:
Namaste!
OK, I've been playing around with this for too long now...
NOTHING gets called when text in a control is set via code or a
mechanism other than strict keyboard/mouse entry by the user from
what I can determine. This, in a word, is not good.
I've set up an observer, delegates, and all that, per previous
posts and only when keys are actually pressed do the delegate
methods get called.
Also, I've noticed that when the record is moved (either next or
previous), there is a "buffer" time between when code executes and
the interface gets changed.
Thus:
- (IBAction)movePrevious:(id)sender
{
[tblPattern selectPrevious:self];
[btnPrevious setEnabled:[tblPattern canSelectPrevious]];
[self pushPicture];
}
Doesn't work. The Apple dox state the reason the move action is
moved to another process is to give the error mechanism a way to
respond.
As a consequence, nothing changes and the code executes, then the
stuff changes. What happens is the previous image gets loaded as
the current image, despite what the textfield says.
Not good.
For a simple "OnChange" thing, this is absolutely frustrating (and
has resulted in quite a bit of code).
Bottom line is, it looks like I need some way to "see" changes that
were made to either the underlying Cell (thinking along the lines
of display changes) or some other route to take this.
I have three scenarios under which the image needs to get pushed:
1. When selected from a file.
2. On Window display - first record is displayed.
3. When records are scrolled (Move Next/Move Previous).
I've solved #1, though I don't like having to "manually" push the
image (meaning I call the pushPicture routine). 2 & 3 are still
unsolved at this point.
Any further thoughts??? Anyone else only keep paths to images and
dynamically load from that data? Storing the pictures in the data
structure is not going to happen as they'll take up far too much
space and suck resources.
Thanks for all the help so far!
Peace, Love, and Light,
/s/ Jon C. Munson II
_______________________________________________
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