Maxscript .net listview highlighting issue

Hey All,

When creating a regular maxscript listbox a highlighted item remains highlighted even when the UI element is not active/in focus. On most machines this is a highlighted blue color.

Using .net listview the highlighted item will turn white when not active/in focus. I believe this is because the colors are based off of the Windows system colors. I’d like the listview to be always highlighted even if not in focus since the user should easily see what is clicked when dealing with other parts of the UI.

While different forums (CGTalk for example) mention the problem – I have yet to find a good solution. Currently I have written a horrible hack that that re-focuses the UI element when the user clicks on different parts of the UI. For example, I have a dotNetControl named dnc_listview and call dnc_listview.focus(). I’ve also tinted the background so the white shows up better and still suggests to the user that something is selected.

Anyone here deal with this issue and figured out a more elegant solution?

Thanks in advance,

J.

Have you tried the HideSelection property set to false? Dunno if it works thow.

[QUOTE=Kameleon;6955]Have you tried the HideSelection property set to false? Dunno if it works thow.[/QUOTE]

Hi Kameleon, thanks for the response. I am currently using the hideselection = false. This is allowing the blue highlight to at least turn to white, but I would like to override that secondary color change when the listview is not in focus. :slight_smile:

This unfortunately leaves me in my current situation. When in focus - the highlight is blue – otherwise it turns white. I would like to override that system color if possible.

I’m believe this is controlled by the user’s color scheme (in XP, Control Panel -> Display -> Appearance). Try changing it and see what happens (and if that doesn’t work, try changing on the Themes tab). I’m not sure what aspect of the scheme controls that color, though.

Hey Rob,

I want to roll out the script on different users machines and don’t want to mess with their color schemes. After doing some reading on different forums I tried implementing the following solution:

– instantiate the control (user still needs to set it up – but I’ve skipped that part.)
dotNetControl dnListView “System.Windows.Forms.ListView”

– hack to keep focus on the listview
timer refresh “refreshUI” interval:100
on refresh tick do
(
dnListView.Focus()
)

Unfortunately it obviously pulls focus all the time from other areas of the UI.

I also tried a .net listbox which does do proper highlighting control, but it doesn’t appear to support the bold and italics and a slew of other nice UI features that the listview has.

Ok… so here is a proper answer (hobbled together from a CGTalk post)

.OwnerDraw allows the user to control how the items are drawn

With this the user can add two methods to the rollout to control the color of the highlighted items.

dnListView.OwnerDraw = true

local selColor = (dotNetClass “System.Drawing.Color”).fromARGB 238 204 85 – custom selection color (orangey-yellow)
local lvBackColor = selColor.fromARGB 225 225 225

on dnListView ItemSelectionChanged arg do
(
arg.Item.BackColor = if arg.isSelected then selColor else lvBackColor
)

on dnListView drawitem arg do
(
arg.DrawBackground()
arg.DrawText()
)