KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Add .Tag to Item object

 
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion
View previous topic :: View next topic  
Author Message
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Sat Apr 17, 2004 1:19 am    Post subject: Add .Tag to Item object Reply with quote

Would it be possible to add the Tag property to the Item object? I have times I want to pull information, SMS advertisements for example, and I want to show just a few columns of data and then have the person double click to see all the detail information. Each item has its own specific data. I know I could hide/shrink columns but .Tag property would make it cleaner in my opinion.

Thanks

_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Sat Apr 17, 2004 1:18 pm    Post subject: Reply with quote

Hmm. I know what you're saying. You can use arrays with .Tag as well. Maybe this would suit your needs. You can't directly access arrays from the .Tag property though, you'll have to pass it back to a variable to parse the array.

$array = $Listview.Tag
Back to top
View user's profile Send private message MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sat Apr 17, 2004 2:51 pm    Post subject: Reply with quote

Think we can do this.... let me investigate ...
Back to top
View user's profile Send private message
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Sat Apr 17, 2004 3:14 pm    Post subject: Reply with quote

Chris.
Even if it had to be a delimited string, I would be happy, just as long as I don't have to go back out to the computer and ask for information again.

Thanks Shawn. I was surprised when it did not have the Tag property because I thought you were adding it to all the objects.

_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sat Apr 17, 2004 3:42 pm    Post subject: Reply with quote

The Item object is a little different then most other objects. The ListView doesn't keep persistent versions of the item object for EACH item in the list. I could have have done it this way, but thought it would be very memory intensive and slow if it did.

When you create an Item, you get handed back an Item object. But - if you query the same item later, you get back a different object but refering to the same item in the list. Its kinda like getting and setting listview items by VALUE only.

Anyway, even with this - the tag property is still supportable because each item (real item, not item object) has a user definable data area ... i think that .net uses this data area as the TAG property of items ... .net doesn't (afaik) have a seperate property for this data area.

-Shawn
Back to top
View user's profile Send private message
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Sat Apr 17, 2004 3:47 pm    Post subject: Reply with quote

Shawn, so does that mean you're going to try to add a persistent .Tag to each item? I got lost in the explanation and wasn't sure if you feel it can be done.
Back to top
View user's profile Send private message MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sat Apr 17, 2004 4:11 pm    Post subject: Reply with quote

yes it dan be done (afaik) ... what im going to do is use the persistent DATA property (of the REAL ITEM) as the value of object's TAG property. I think this may be what .net does too, but can't tell for sure (obviously).

So in a scenario, say you create an item:

$Item = $ListView.Items.Add()

then set its tag:

$Item.Tag = "mydata"

and then much later on, you reference this same item back (it just happens to be #27) ...

$Item = $ListView.Items(27)

The object $Item is this case is not really the exact same $item as before, its a new object that points to the same REAL ITEM. So thats why the TAG property gets lost. But what I will do now is go back to the REAL ITEM and pull its DATA property and use that for the tag instead. The DATA property of the real item lives with the item and persists.

If this made sense, can you explain it back to me cause i'm lost now Wink

-Shawn
Back to top
View user's profile Send private message
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Sat Apr 17, 2004 4:47 pm    Post subject: Reply with quote

It makes sense. That is why I could use the tag property when I created the item, but as soon as I wanted to go back referencing by index it was gone. That confused me when I first tried to use tag with item because it was there and then it was gone.

I think my ramblings are about as confusing as yours shawn. Wink Laughing

_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Les
KiXforms Aficionado
KiXforms Aficionado


Joined: 24 Dec 2003
Posts: 317

PostPosted: Sat Apr 17, 2004 5:02 pm    Post subject: Reply with quote

Quote:
If this made sense, can you explain it back to me cause i'm lost now

LOL
You think you're confused! Rolling Eyes

Guess I will have to wait for the movie.

_________________
The Repro Man
Stealing for a living!
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sat Apr 17, 2004 5:36 pm    Post subject: Reply with quote

yeah you got it. so i will make the item TAG property just like the TEXT or the IMAGEINDEX property, these other two properties ARE tied to the real listview item ...
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sat Apr 17, 2004 9:01 pm    Post subject: Reply with quote

ok, its done.

so like Chris said, the new ITEM object TAG property can store just about anything you want to store: longs, strings, arrays, objects ... should be able to support any kinda of VARIANT ... and like he explained arrays are special because they have to be "pulled" out of the item first, and then referenced outside of the COM syntax because Kixtart doesn't support indexing into a property that is an array, so the testing I was using this morning looks like this:

Code:

for $i = 0 to 10
 $item = $form.listview1.items.add($i)
 $item.tag = 1,2,3,4,5
next

for each $item in $form.listview1.items
 $ar = $item.tag
 ?"val=" $ar[0]
next


On another (but related) matter, for those that have been using the latest Kixforms Beta ... think its about time I released the next build (with this change) and call it "Release Candidate 1" ? Anybody have any serious issues with the latest beta ?
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sat Apr 17, 2004 9:10 pm    Post subject: Reply with quote

Heres a neat trick, combining the new Kixforms OBJECT object with the TAG property ...

Code:

for $i = 0 to 100
 
 $item = $form.listview1.items.add($i)
 
 $item.tag = $system.object
 $item.tag.name = "john smith"
 $item.tag.address = "43 Maple Avenue"
 $item.tag.phone = "(416) 555-1234"
 
next

for each $item in $form.listview1.items
 
 ?"name=" $item.tag.name
 ?"address=" $item.tag.address
 ?"phone=" $item.tag.phone
 
next


-Shawn
Back to top
View user's profile Send private message
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Sat Apr 17, 2004 9:11 pm    Post subject: Reply with quote

I haven't had any problems with the super secret pre-beta test build that I have.
Back to top
View user's profile Send private message MSN Messenger
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Sat Apr 17, 2004 11:33 pm    Post subject: Reply with quote

I haven't had any problems either.
_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
sptomey
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 18 Mar 2003
Posts: 158

PostPosted: Sun Apr 18, 2004 1:40 am    Post subject: Reply with quote

I've been using 2.3.0.42. Not sure if this is the newest build you are referring to but I haven't had any problems with it either.
_________________
-Shane
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group