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

ListBox ListItem issues

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Fri Jan 06, 2006 1:24 am    Post subject: ListBox ListItem issues Reply with quote

wtf.

in here:
http://www.kixforms.org/forum/viewtopic.php?t=1070

you add stuff to listbox as if the list items were strings.
though, reading from CHM, this seems the correct way:
$Item = $ListBox.Items.Add($System.ListItem)

or how else one is able to edit the item objects properties value and text?

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Fri Jan 06, 2006 1:41 am    Post subject: Reply with quote

The syntax is ListBox.Items.Add(object), where object can be anything you want ... if you add strings, then your SOL when it comes to editing items in the list because Kixtart doesn't support this syntax here:

$ListBox.Items.Item(0) = "new string"

so you need to add something that is more than just a string, something you can get "a handle" to - like a ListItem or a DataItem.
Back to top
View user's profile Send private message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Fri Jan 06, 2006 1:58 am    Post subject: Reply with quote

well, like said, you used add("some text here") format.

the problem is that if I try to add listItem object (look the syntax above), it will fail and kixtart will throw crap to console.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Fri Jan 06, 2006 9:35 pm    Post subject: Reply with quote

shawn, you gonna fix this or is the current behavior gonna stick?
don't wanna publish anything until it's permanently decided.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Fri Jan 06, 2006 9:50 pm    Post subject: Reply with quote

Dont do or post anything until I get a chance to chat with you over MSN, the last few days have been busy but will hopefully catch you soon.
Back to top
View user's profile Send private message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Fri Jan 06, 2006 10:07 pm    Post subject: Reply with quote

k, I shall hold my breath then...
_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Sat Jan 07, 2006 3:18 am    Post subject: Reply with quote

k, I was able to insert a ListItem into listbox:
$ = $Listbox.Items.Add($System.ListItem("something,""))

now, instead of showing the text element of the item, listbox shows the toString() of the object, which is "KiXforms.System_ListItem"

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sat Jan 07, 2006 4:04 am    Post subject: Reply with quote

Set the "Member" of the ListItem you want to "Display" (the Text property?) using the ListBox.DisplayMember property.

$ListBox.DisplayMember = "Text"

-Shawn
Back to top
View user's profile Send private message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Sat Jan 07, 2006 6:03 am    Post subject: Reply with quote

NEAT!
that's so cruel!

it so works.
thanks dada.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sun Jan 08, 2006 2:53 pm    Post subject: Reply with quote

I just realized something - need to change the return value of ListBox.Items.Add to return the object, instead of the integer - will that screw you up ?
Back to top
View user's profile Send private message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Mon Jan 09, 2006 12:56 am    Post subject: Reply with quote

nope, it doesn't.
actually, that's what I expected in the first place.
and thought your item thingie did not work at all as it didn't return "properly"
got it working using the inline way.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET 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