Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Blue GUI - creating a selection list

Author
Message
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 4th May 2005 22:50 Edited at: 4th May 2005 22:51
I need to create a list that I can select and deselect items from. For example:

.X. Item 1
. . Item 2
. . Item 3
.X. Item 4
.X. Item 5


Anybody got any ingenious ideas? The list needs to be permanently visible (scrollable is fine), so not too big.

BatVink
Rob K
Retired Moderator
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 4th May 2005 23:18
Probably the neatest way of doing this would be to have a listview with two columns, one for the item name and one for the selected / not-selected status.

When an item is double-clicked, check which row was changed (There are listViewItemAtPoint and listViewSubItemAtPoint commands for this) and toggle the Yes/No or On/Off etc. state of the item and text in the status column.


BlueGUI Windows Plugin
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th May 2005 00:55
Sounds good, I'd missed the multicolumn feature of listview. I'm guessing I can set a column width to 0 and hide a column containing data I need but don't want to display.

I set about this task with a treeview component, with just one level. I wanted to chnage the font of individual items, but it didn't seem to work. I know it's possible from my VB coding, but maybe I'm stretching the application of gadget handles?

BatVink
Rob K
Retired Moderator
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 5th May 2005 01:18
Quote: " I know it's possible from my VB coding, but maybe I'm stretching the application of gadget handles?"


Visual Basic doesn't use 'normal' treeviews, It uses custom code to render the items. I'd like to provide some sort of interface for custom drawing of items in listviews, treeviews and menus, but I haven't been able to come up with an ideal solution yet.

Quote: "I'm guessing I can set a column width to 0 and hide a column containing data I need but don't want to display."


You probably can, but I would advise using an array instead. The downside is that you have to manage the contents of the array in-sync with the items, but there may be visual glitches with an 0-width column.

Quote: "I wanted to chnage the font of individual items"


You could set each item's text to an empty string and then overlay labels on top (using the listViewItemX, listViewItemY functions)


BlueGUI Windows Plugin
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th May 2005 01:54
Quote: "You probably can, but I would advise using an array instead"


That's what I'm doing already, but the many-to-many relationship of my entities result in reading arrays from top to bottom just to find relationships Sticking the relationship in a hidden column would be perfect. I tried setgadgetdata with the treeview, but it doesn't seem to extend to individual tree elements.

BatVink
Rob K
Retired Moderator
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 5th May 2005 03:27
Quote: "That's what I'm doing already, but the many-to-many relationship of my entities result in reading arrays from top to bottom just to find relationships"


That really shouldn't be necessary.

There are basically two functions which can affect the order of items in a listview, addListViewItem and removeListViewItem.

All you need to do is to write two wrapper functions which add / remove the item as well as adjusting an array of user data as needed.

This code demonstrates how to associate a piece of string data with each item in a listview:



Select the item by clicking on it, enter the text to associate with the item in the box below. Press the Delete key to delete the selected listview item.


BlueGUI Windows Plugin

Login to post a reply

Server time is: 2024-11-21 15:03:39
Your offset time is: 2024-11-21 15:03:39