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

ForeColor property for ListBox

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


Joined: 10 Aug 2005
Posts: 50

PostPosted: Sat Jan 14, 2006 5:59 pm    Post subject: ForeColor property for ListBox Reply with quote

Any plans on adding support for setting the ForeColor property on individual items in a ListBox as you can in a ListView object?
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 Jan 14, 2006 6:49 pm    Post subject: Reply with quote

Let me check if .net supports that ...
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 Jan 14, 2006 8:37 pm    Post subject: Reply with quote

The official answer is no. Standard Microsoft .NET does not allow one to color specific items in a ListBox ... the un-official answer will need some more research ;0)
Back to top
View user's profile Send private message
mercury
KiXforms Regular
KiXforms Regular


Joined: 10 Aug 2005
Posts: 50

PostPosted: Sun Jan 15, 2006 5:40 pm    Post subject: Reply with quote

Thanks Shawn
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sun Jan 15, 2006 6:33 pm    Post subject: Reply with quote

Since none of this stuff is supported by Microsoft , we will have to extend the ListBox to support this ourselves. Not sure if you've given any thought to how this might work though ... you might be surprised at the details.

1) Since the .Net ListBox stores and displays arbitrary objects (and thats all) - the ForeColor for individual "items" should (and this my take right now) live within the item itself.

2) Having said that - if you store a simple string inside a ListBox - then there is really no way to specify a ForeColor for that particular item (because a String does not have a ForeColor property).

Having said that - what I was thinking about doing was as follows:

1) Extend the ListBox control to display colored items. The listbox would check if the item has a ForeColor property, if so - it will use that color for that item only - if not, then the ListBox ForeColor will be used.

2) Extend the ListItem object to support the ForeColor property.

So now - to display Items with different colors in a ListBox, just populate the ListBox with ListItems and set their ForeColor property accordingly.

The thing is - this strategy may not be as straight-forward as using strings within a ListBox though. These are just my ramblings on this subject to now.
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 16, 2006 7:10 am    Post subject: Reply with quote

so, you have some non-.net listbox in kf .Net?
if you say .net does not support this, wouldn't that imply that it isn't doable with system.windows.forms stuff?

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


Joined: 10 Aug 2005
Posts: 50

PostPosted: Mon Jan 16, 2006 11:12 am    Post subject: Reply with quote

Personally I would very much like the addition but I would also respect if the general policy was full .Net conformity.. i.e. if .Net doesn't support a certian feature neither will KiXforms.Net.

My only concern would be cross 'platform' development where I might want to convert from KiXforms to a compiled language and find that a bunch of neat tricks no longer work. In this case I have a choice of the ListView for pretty colours even though it is overkill for the intended function...but then it's nice to have future options at hand..

So really it's up to you and the community weather we should break from the standard and 'fix' any .Net shortcummings. It may not be a bad thing as long as pre-existing .Net standards are not changed.
Back to top
View user's profile Send private message
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


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

PostPosted: Mon Jan 16, 2006 1:02 pm    Post subject: Reply with quote

It can always noted in the decumentation if a certain function/event/property/... is not supported by native .NET but is a Shawn-enhancement.
_________________
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
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Jan 16, 2006 1:33 pm    Post subject: Reply with quote

Well your right. But tbh, I've already taken "some license" with some things - mostly because of the following two reasons:

1) Something deviates from the standard because it won't work in Kixtart otherwise.

2) Something deviates from the standard because it works better in Kixtart.

An example of the first one is the creation of the ListItem object (which doesn't exist in .Net - but does in ASP.NET though) and the creation of the DataItem object (which doesn't exist in .NET at all). Without these two objects, setting the values of Items would be kinda tough.

An example of the second one is the "rule" I adopted that Collection.Add methods should return the Object that was added (instead of the dotnet way of returning a) Nothing, b) an Integer or c) the Object. This rules (to my mind) just gives some consistency.

Anyway, I think we can build the ListBox to support colored items in a compatible way - that caveat would be that if one used the extended features, that it would not port to pure dotnet - I'm not too worried about that.

Plus - would like to add some other stuff to the listbox down the road anyways - like Icon support for items.
Back to top
View user's profile Send private message
mercury
KiXforms Regular
KiXforms Regular


Joined: 10 Aug 2005
Posts: 50

PostPosted: Mon Jan 16, 2006 2:09 pm    Post subject: Reply with quote

Well in that case, More strenght to KiXForms.Net! Smile

The only reason I would consider porting a script to VB.Net in the first place is because the site admins didn't want to use KiXtart.
- Their loss.
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Jan 16, 2006 8:45 pm    Post subject: Reply with quote

Merc/Jooel

Would you two guys mind very much if I changed the return value of the

ListBox.Items.Add(object)

method to return the object that was added, instead of the index of the object that was added ? Would that mess-up your scripts at all ? It would just apply to the Add method. The Insert method already returns the Object inserted.
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Jan 16, 2006 10:03 pm    Post subject: Reply with quote

Hey Merc, the other thing I wanted to ask you. What kinda things are you putting in your ListBox ? Strings ? ListItems ? something else ? Are you simply listing items, and if the list changes - are you rebuilding it ? Are you dynamically changing items in-place ? Maybe removing/inserting/deleting ?
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Jan 17, 2006 5:43 pm    Post subject: Reply with quote

Guys,

I added a new Work-In-Progress build to the KF.NET Development Build Announcement ... this build is my work-in-progress - its basically the next release. I seperated them because as a work-in-progress, there may be issues, and you might need to re-install the more stable one.

I added color support to the ListBox ... but I mostly right now want to make sure that your existing scripts will work correctly - and (very important) dont LOOK too different.

Will be posting a script shortly showing how the new color support works.

-Shawn
Back to top
View user's profile Send private message
mercury
KiXforms Regular
KiXforms Regular


Joined: 10 Aug 2005
Posts: 50

PostPosted: Tue Jan 17, 2006 6:06 pm    Post subject: Reply with quote

Thanks Shawn, I'll check it out later tonight. I am mainly adding strings and refreshing the list when I make a change. I do this to make sure the change has taken as I'm querying AD.
Back to top
View user's profile Send private message
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