I’ve been playing around with the dotnet listview trying to make it look / feel like a MultiListBox control.
The style i’m using is System.Windows.Forms.View.List
The immediate differences are:
1. Even with ‘fullRowSelect’ on, it doesn’t really select a full row - only to the extent of the text.
2. I don’t need to be able to marquee select items yet still be able to click + drag select.
3. the MultiListBox has a black outLine around it which is not a big deal but would be nice to know
If you’re not sure about what I mean, check out the differences in this example code:
(
global lvTestRollout
try(destroyDialog lvTestRollout)catch()
rollout lvTestRollout "lvTestRollout"
(
local ListItems = #("These are some items", "for the example of", "the ListViews", "vs", "the MultiListBox")
dotNetControl lv "System.Windows.Forms.ListView" height:150
multiListBox lb "MultiListBox" height:10
fn initListView =
(
lv.backColor = (dotNetClass "System.Drawing.Color").FromArgb 225 225 225
--The following controls the display of details. We use defaults:
lv.gridLines = true
lv.View = lv.View.List
lv.fullRowSelect = true
lv.hideSelection = false -- show selected objects when listview is not in focus
)
fn fillInListView =
(
theRange = for i in ListItems collect dotNetObject "System.Windows.Forms.ListViewItem" i
lv.Items.AddRange theRange
)
on lvTestRollout open do
(
initListView()
fillInListView()
lb.items = listItems
)
)
createDialog lvTestRollout width:400 height:320
)
EDIT: ok so i’ve answered the first 2 questions a few mins after posting…
It’s not 100% the same but close enough. It seems I need to use System.Windows.Forms.View.Details and add a column for fullRowSelect to work properly which also seemed to solve number 2. Even though you use a marquee selection, it behaves pretty much like the MulitListBox. I’d still prefer not to use the marquee if anyone knows of a way around it but it but as I said it’s close enough for now. Also I still havn’t figured out problem 3…


