|
-
July 18th, 2003, 09:16 AM
#1
Howto make ListView behave as a listbox
I am replacing a Listbox control with a ListView control in my app because I want a small icon on the left hand side of the text. My problem is I cannot seem to find the correct properties to set to make it behave exactly like a listbox. Below is how I set up the ListView control. but the problems I am having are
1. When I use the remove method a gap is displayed where a item was removed. ListBox will push all the items up. The only way I solved this was to re-sort the list. This causes a annoying refresh jitter so I would rather not do this.
2. I cannot seem to add to the "top" of the listbox when I want to add a new item.
3. When an item is selected the listbox control will keep the item highlighted even if the listbox loses focus. ListView doesn't seem to do this.
How can I fix the above?
Here is my ListView initalization code.
objListView.MultiSelect = False
objListView.AllowColumnReorder = False
objListView.Appearance = cc3D
objListView.Arrange = lvwNone
objListView.Checkboxes = False
objListView.Sorted = False
objListView.LabelEdit = lvwManual
objListView.FullRowSelect = False
objListView.GridLines = False
objListView.Enabled = True
objListView.LabelWrap = False
objListView.View = lvwSmallIcon
objListView.OLEDragMode = ccOLEDragAutomatic
objListView.OLEDropMode = ccOLEDropNone
objListView.SmallIcons = objImageList
Thanks in advance
Jean-Guy
-
July 18th, 2003, 09:29 AM
#2
Listview behave like a LisBox :
.View = 3 - lvwReport
.LabelEdit = 0 - lvwAutomatic
.HideColumnHeaders = True
.HideSelection = False ' Keep highlight
.FullRowSelect = True
' note that you will have to add a column for this to work, and set the column size too acording to your control size.
1 - The gap will be removed by setting the View to lvwReport (i think)
2 - to add an item in the first line :
ListView1.ListItems.Add 1, , "Line text"
1 being the index where the new line will appear.
3 - .HideSelection = False will fix your problem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|