Greg Dance wrote:
[snipped to leave some options from Greg's post]
-singlesel => 1,
-style => WS_CHILD | WS_VISIBLE | 1,
-fullrowselect => 1,
-gridlines => 1,
-checkboxes => 1,
What I found is that the -style line is the culprit. When this
is included the -singlesel option doesn't do anything. I'm not sure what
the -style option is specifically doing, but that is the source of the
problem.
Several things to learn from this:
(1) Short, complete examples are not just for the benefit of the
audience that you post to; they often lead to solving (or at least
narrowing down) the problem.
(2) That's probably one of the reasons that the -style option generates
a 'deprecated' warning (you are running with warnings on?)
And for reference, the options that I've left above all do things with
the control's 'style', and are processed in order. All the options
except '-style', either add or remove style bits from a mask. '-style'
clobbers the mask with a fixed value - it's useful if you know what
you're doing, but dangerous (as you've discovered) otherwise. There are
a number of ways this could be re-written so that it works, the easiest
would be to move the -singlesel option after the -style option - but
note that none of the styles used in the -style line are required by
modern Win32::GUI versions: WS_CHILD and WS_VISIBLE are default options
for a listview (and most, if not all controls), and I'm not sure what,
if anything, setting bit 0 does.
Glad you've sorted it.
Regards,
Rob.