Re: IKImageView selection issue
Re: IKImageView selection issue
- Subject: Re: IKImageView selection issue
- From: Christian Graus <email@hidden>
- Date: Fri, 6 Feb 2009 15:49:09 +1100
On Fri, Feb 6, 2009 at 2:40 PM, Graham Cox <email@hidden> wrote:
>
> On 6 Feb 2009, at 2:14 pm, Christian Graus wrote:
>
> OK - that makes some sense, excepting that if I don't set the delegate,
>> and just define the methods, they don't get called at all. Also, all the
>> delegates are useless to me, b/c none of them fire when the selection has
>> been made, only when the box is initially created. I've set the delegate to
>> be the class that contains it and resolved my overall issue, but I cannot
>> get a mouseUp event from the IKImageView, without which, I don't see how to
>> respond to the end of a selection action, as opposed to the start of it ?
>>
>
>
> I'm beginning to get a glimmer of what you're trying to do. Maybe you could
> help me out and just tell me?
OK - I have a IKImageView which is contained in another class. If I handle
the delegate inside the IKImageView derived class, then it crashes. If I
don't do [self setDelegate:self], then the delegate methods are not called.
If I make the containing class handle the delegate, then the delegates are
called. But, I want to drag out a selection area, then immediately zoom in
to it. There is no delegate for the end of dragging a selection box. I
also cannot get a mouse up event for the IKImageView, which would then allow
me to check if there's a selection ( I believe I do this by checking the
clipboard, but right now I don't know if I check it for a Rectangle, or for
some other construct, the docs do not say ).
>
>
> I can't see what the delegate's methods are in the documentation I have, so
> maybe I'm not up to date. But I'm sort of guessing that -selectionRectAdded:
> is a delegate method. Where did you find out about it?
>
http://www.theregister.co.uk/2008/10/14/mac_secrets_imagekit_internals/
>
> Incidentally while the pattern I mentioned of both the object and its
> delegate implementing <foo> it's not necessarily always the case, in fact
> it's not that common, though I have seen it. The infinite loop potential is
> one good reason for not organising code that way. So just adding a delegate
> method to the class itself isn't guaranteed to be called, and in fact is
> unlikely.
Yeah, I expected that to be the case, but the issue is now that while I got
around that with your help ( thank you ) I cannot get a mouse up event on
the IKImageView at all, this basically would make the control useless to me,
as I have four images on screen and what I want is to have tools such as
flip ( which the control supports ) work by selecting a tool, then clicking
on the image I want to flip ( so, that means I need to get the mouse event
on the control ).
>
>
> Anyway, you make a selection and you want to find out at the end of that
> what it is. I see no method to obtain that rect (enhancement request time?
> Seems like a sensible thing to want to do, though I think the design
> philosophy of IKImageView is that it's self contained - it performs the
> necessary crop or whatever for you, and you just get the modified image
> back). If overriding mouseUp: doesn't fire, that suggests to me that
> IKImageView is handling its own tracking loop, in which case overriding
> mouseDown:, and calling super will give you a place to respond at the end of
> the tracking loop.
>
OK - so I should put a mouseUp or mouseDown method in the derived class ? I
was considering trying this, so I will try that next. As I said, the
control doesn't appear to actually do a crop, per se, it passes *something*
to the clipboard, I have no idea what. For a selection, I am hoping it's a
rect, but in reading the pasteboard docs, I am unsure how I can go about
finding out what was pasted, I appear to need to specify what format I want.
There does appear to be a method that *may* tell me what format is
available, although it reads more like it will list what formats are
supported.
>
> Another thing to note is that Apple, with some of their more recent
> classes, are expecting you to use KVO or bindings to observe changes. Not
> that I can see a property that you could observe for this, but I'm not
> looking that hard - after all it's not my problem ;-)
>
OK - I admit to being VERY new to Objective C and Cocoa, having recently
migrated from the Windows world. I will google KVO, but in the first
instance, I really don't know what that is :P
>
> And what's drag and drop to do with this? Maybe if you could take a bit
> more care to explain a) what you're trying to do and b) what you've tried
> then maybe some things might fall into place.
>
OK - the control that contains the IKImageView also contains a QuickTime
control. I have a listview, the user can drag objects from the listview to
open them and either the IKImageView or the QuickTIme view is shown,
depending on the format of the item. So, there's drag and drop code, but
setting the delegate to self was causing it to be called when I didn't want
it to. Moving the delegate to the containing class seems to have solved
this issue. However, odds are I won't use a delegate at all, as I cannot
get a mouse event and I don't care about any of the events that that web
page lists for IKImageView ( that there's no event for the moment that a
selection has been made, passing in the rect of the selection or an object
that defines it, is really inexplicable to me )
Thanks so much for your help
Christian
>
> --Graham
>
>
>
_______________________________________________
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