Solution:
try(destroydialog ::ListviewBugTest)catch()
rollout ListviewBugTest ""
(
dotNetControl lv "System.Windows.Forms.ListView" width:250 height:150 align:#center pos:[10,10]
on ListviewBugTest open do
(
-- Setup the listview
lv.View = (dotNetClass "System.Windows.Forms.View").Details
lv.fullRowSelect = true
lv.Columns.add ("Column "+i as string)
-- Add items to listview
for x=1 to 5 do
(
local newItem = dotNetObject "System.Windows.Forms.ListViewItem" ("Col." + x as string)
lv.items.add newItem
)
)
on lv ColumnClick e do
(
clearlistener()
for i = 1 to lv.Items.count do
(
idx = i - 1
lv.Items.item[idx].Selected = true
)
)
)
createDialog ListviewBugTest 270 170
for i = 0 to lv.Items.count-1 do lv.Items.item[i].Selected = true
there is a story…
the hearing of the case… one guy killed a granny and took 10 cents from her wallet. the judge is asking him:
- Why? Why did you kill the granny for just 10 cents?!
- Eh, Your Honor… Your truth… One granny is just 10 cents. But ten grannies are the BUCK!
Hey Awesome post guys. I was looking at some of the scripts in this post and something caught my attention. I added lv.HideSelection= false to Joker’s latest snippet where hes got the clickable column and when the listview loses focus it still loses the display of the selected items. Am I missing something here?
try(destroydialog ::ListviewBugTest)catch()
rollout ListviewBugTest ""
(
dotNetControl lv "System.Windows.Forms.ListView" width:250 height:150 align:#center pos:[10,10]
on ListviewBugTest open do
(
-- Setup the listview
lv.View = (dotNetClass "System.Windows.Forms.View").Details
lv.HideSelection= false
lv.fullRowSelect = true
lv.Columns.add ("Column "+i as string)
-- Add items to listview
for x=1 to 5 do
(
local newItem = dotNetObject "System.Windows.Forms.ListViewItem" ("Col." + x as string)
lv.items.add newItem
)
)
on lv ColumnClick e do
(
clearlistener()
for i = 1 to lv.Items.count do
(
idx = i - 1
lv.Items.item[idx].Selected = true
)
)
)
createDialog ListviewBugTest 270 170
the selection in your sample doesn’t loose. it just becomes light. the color of inactive (unfocused) selection is a system color defined by your settings. there is no special ListView property to set it.
everything that i said above is true but… as usually there is a trick.
inactive lv selection shows with SystemColor.Menu. if you set lv backcolor to SystemColor.Menu the inactive selection will be always shown with SystemColor.MenuHighlight:
try(destroydialog ListViewTest)catch()
rollout ListViewTest ""
(
dotNetControl lv "ListView" width:110 height:130 align:#center pos:[5,5]
on ListViewTest open do
(
-- Setup the listview
lv.View = lv.View.Details
lv.HideSelection = off
lv.FullRowSelect = on
lv.BackColor = (dotnetclass "System.Drawing.SystemColors").Menu
lv.Columns.Add "Items"
-- Add items to listview
for k=1 to 5 do lv.Items.Add ("Item." + k as string)
)
)
createDialog ListViewTest 120 140
There is always a trick! Right on Denis ! Thx i actually thought it was losing the selection because on my screen the colors are so washed out that it actually looked white and not greyed out… I guess its time to finally get rid of these 8 year old LCDs They just do not make syncmasters like they used to…
How can I bind the width of the column label “Objects” to the width of the entire listview?
I want the header to cover the entire span of it. I want it to work as the user resizes the dialog. I’ve got the listview itself working but not sure how to get the column label to react as explained.
I’m simply just trying to make a multilist which only has one column and with the ability to resize with the dialog.
try(destroydialog ::rlList)catch()
rollout rlList ""
(
dotNetControl lvObjects "System.Windows.Forms.ListView" width:250 height:150 align:#center pos:[10,10]
on rlList open do
(
-- Setup the listview
lvObjects.View = (dotNetClass "System.Windows.Forms.View").Details
lvObjects.fullRowSelect = true
lvObjects.Columns.add ("Objects")
-- Add items to listview
for x=1 to 5 do
(
local newItem = dotNetObject "System.Windows.Forms.ListViewItem" ("Col." + x as string)
lvObjects.items.add newItem
)
)
on lvObjects ColumnClick e do
(
clearlistener()
for i = 0 to lvObjects.Items.count-1 do lvObjects.Items.item[i].Selected = true
)
on rlList resized val do (
w = val[1]
h = val[2]
lvObjects.width = (w-20)
lvObjects.height = (h-40)
)
)
createDialog rlList 270 190 style:#(#style_SysMenu, #style_ToolWindow, #style_resizing)
Thanks lo for the quick response.
I’ll try it out and get this dialog working!
Thank you.
Hey Lo i recently came across your example here on this thread: http://forums.cgsociety.org/showthread.php?t=950936
I was wondering if you could show me how to take the existing dialog I have here with the listview and place two buttons underneath it which would also scale in ‘width’ to fill the dialog.
Example image shows what I mean.