Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag and Drop Problem



On 6/3/06 8:58 PM, "Dean Shavit" <email@hidden> wrote:

> OK, I've got a tough one. I've added drap-and-drop capabilities to a
> tab view item via a custom view in a tab view in a window and that
> works well in Tiger, the problem is that when run in Panther (it's
> not an option to have separate versions) I get an immediate
> NSCannotCreateScriptCommandError (10) triggered by the registration
> of drag types in the awake from nib handler. Here's the code:
> 
> 
> 
>      if the name of theObject is "DropZone" then
>             -- We will register for the following types (altough this
> example only responds to the "string" type).
>             tell theObject to register drag types {"string"}
>         end if
> 
> Any ideas why Panther would reject this and not Tiger?

According to the Reference 'register drag types' was implemented in Studio
1.2 - OS 10.2. It should work for Jaguar and Panther too.

You say you are using a tab view. I have found in the past that 'awake from
nib' and other events will only operate on a tab view item which is the
'current tab view item' (displayed) of the tab view. Perhaps when you've
been testing this your Tiger example happens to have the "DropZone" tab view
item (or "DropZone" subview of the tab view item - you don't tell us what
"DropZone" object is) displayed as/in the current tab view item, while your
Panther example has some other tab view item as current, so "DropZone" is
inaccessible and commands to it will error.

If this is the case, you should write some 'if' conditional code to register
drag types on it only if it (or its containing tab view item) is current tab
view item of the tab view. Then also write some conditional code in the
event handler for changing tab view items ('on selected tab view item
theObject tab view item theTab') that registers drag types when name of
theTab is "DropZone". You should perhaps also have a script property
(dropZonePrepared) set to false at the beginning which you reset to true
when you first register drag types for it (whether 'on awake from nib' or
'on selected tab view item') and include 'if not dropZonePrepared' as a
condition for the 'on selected tab view item' handler if it does not need to
be re-registered each time it's selected, as I'd guess it doesn't.

-- 
Paul Berkowitz

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

References: 
 >Drag and Drop Problem (From: Dean Shavit <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.