Xojo Conferences
XDCMay2019MiamiUSA

Help please. Why is "Item = nil"? (Real Studio getting started Mailinglist archive)

Back to the thread list
Previous thread: Recursion of Recursion of Recursion....of RecusionX
Next thread: writing sideways workaround


RB Database   -   tom.russell transport.alstom.com
  Help please. Why is "Item = nil"?   -   Lennox Jacob
   Re: Help please. Why is "Item = nil"?   -   Joseph J. Strout
    Re: Help please. Why is "Item = nil"?   -   Lennox Jacob

Help please. Why is "Item = nil"?
Date: 02.02.06 16:42 (Thu, 2 Feb 2006 07:42:27 -0800 (PST))
From: Lennox Jacob
Hello,

I have an app A which has two windows B & C.
Window A has two Canvasses B & C, so when the app is launched Window A opens and I can now click in B (or C) to open B (or C).

When I create a file in B (or C) I can then double click on its icon and App A will open the appropriate window and display the contents of the file as expected.

When I create a file in B (or C) I can then drag its icon over App A icon, App A will open the appropriate window and display the contents of the file as expected.

The problem is when I create a file in B (or C) I can then drag its icon over its own icon in App A window, App A gives "Item = nil"

This is the code I have in Canvas B (and C) DropObject event:

Dim item, items() as folderitem
Items().Append item
Dim Filestream as TextInputStream

If item = Nil then // The file does not exist
msgbox "item = nil"
return
elseif item.directory then
filestream = item.openAsTextFile
....
end if

OK I have an idea what is happening,
When I drag the icon over the canvas B (orC) in App A window, Item = nil because no reference is made to the item,

How do I reference that item?

I can use item = GetOpenFolderitem("") and this will display open file dialog and then allow me to navigate for the file, but I do not want to do that.

If I use item = GetFolderitem("") I do not get the "Item = nil" but the item seems to be empty.

Thanks.

Lennox.


---------------------------------
Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Help please. Why is "Item = nil"?
Date: 02.02.06 18:22 (Thu, 2 Feb 2006 10:22:51 -0700)
From: Joseph J. Strout
At 7:42 AM -0800 2/2/06, Lennox Jacob wrote:

>The problem is when I create a file in B (or C) I can then drag its
>icon over its own icon in App A window, App A gives "Item = nil"
>
>This is the code I have in Canvas B (and C) DropObject event:
>
>Dim item, items() as folderitem

OK, so you have item = nil, and items() is an empty array.

>Items().Append item

Now you've appended nil (which is the value of item) to your array.

>Dim Filestream as TextInputStream
>
>If item = Nil then // The file does not exist

...and of course, item is still nil. You never assigned anything to
it, so how could it be otherwise?

>How do I reference that item?

If you mean the folder item in the DragItem, you use the 'obj'
parameter; specifically, obj.FolderItem (after checking
obj.FolderItemAvailable).

>If I use item = GetFolderitem("") I do not get the "Item = nil" but
>the item seems to be empty.

No, in this case item would be the folder containing your application.

Best,
- Joe

Re: Help please. Why is "Item = nil"?
Date: 03.02.06 00:24 (Thu, 2 Feb 2006 15:24:32 -0800 (PST))
From: Lennox Jacob
Thanks Joe,

If you mean the folder item in the DragItem, you use the 'obj'
parameter; specifically, obj.FolderItem (after checking
obj.FolderItemAvailable).

Works now.

Lennox.

---------------------------------
Brings words and photos together (easily) with
PhotoMail - it's free and works with your Yahoo! Mail.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>