PDA

View Full Version : DotNet Treeview HideSelection property not working


Pjanssen
01-13-2008, 07:32 PM
Hey,

I've got a bit of a problem: setting the HideSelection property on a treeview dotnet object doesn't seem to do anything. I set it to false (and when I print it, it is indeed set to false), but it keeps losing the selection background when the control loses focus.
I know that there has been a thread about this, but I couldn't find it anymore (the search on this forum is pretty ...ineffective).

Any ideas?

RustyKnight
01-13-2008, 10:29 PM
Hey,

I've got a bit of a problem: setting the HideSelection property on a treeview dotnet object doesn't seem to do anything. I set it to false (and when I print it, it is indeed set to false), but it keeps losing the selection background when the control loses focus.
I know that there has been a thread about this, but I couldn't find it anymore (the search on this forum is pretty ...ineffective).

Any ideas?Actually, this is a microsoft issue...for some reason, they've decided, that when ever a control loses focus, the selection highlight will also be lost (not the actual selection)...I think I did something where when the focus was lost, I set the background color of the selected item to some color (like lightgray or something) and back again when the focus was gained...

Shane

edt: in hind sight, this might actually be max issue, but the result is the same...

PEN
01-13-2008, 11:28 PM
This is what I did but there was a switch I believe that keeps it selected. Search around for posts on it by me as I asked the same thing at some point and some one had a solution I believe other then coloring the BG.

PEN
01-13-2008, 11:42 PM
I just checked my code and I'm still just coloring the BG as it worked and I didn't have time to update it.

RustyKnight
01-14-2008, 12:09 AM
This is what I did but there was a switch I believe that keeps it selected. Search around for posts on it by me as I asked the same thing at some point and some one had a solution I believe other then coloring the BG.NO, you can't!! It took me ages to work out how to do this, you can't waltz on in here now and tell me there's an "easier solution"...I want to cry...

Thanks Pen! This will make life eaiser!

Cheers
Shane

PEN
01-14-2008, 01:10 AM
Here it is...


This forces the selected item to be visible even when the treeview is not in focus:
tv.HideSelection = false

Martijn

RustyKnight
01-14-2008, 01:22 AM
Here it is...Isn't that what we started with??

Pjanssen
01-14-2008, 05:44 AM
This forces the selected item to be visible even when the treeview is not in focus:
tv.HideSelection = false
Like Shane pointed out, this is what the thread is all about, it isn't doing anything for me ;)
I have tested it in Visual Studio, and it works fine there, so it must be some max issue.

This is what I did but there was a switch I believe that keeps it selected. Search around for posts on it by me as I asked the same thing at some point and some one had a solution I believe other then coloring the BG.
Could you perhaps post a snippet of your code? I've tried doing this as well, but it seemed to me as if the actual selection coloring (or removing) happened after the lostFocus event was fired. So even though I set the node background color to the selection color by hand, it would be removed again straight after...

PEN
01-14-2008, 10:47 AM
I'll have to dig for the code again. Can you post what you have or write a test script that shows the problem?

Pjanssen
01-14-2008, 01:31 PM
Hm it looks like the problem isn't with the hideselection not working, but with the color.... (arg).
I had set the background color of the treeview to match the rest of the max UI, but this is exactly the same color as the color of the selection background when the treeview doesn't have focus....Great....

So now I'd like to have a way to set the 'out of focus selection color' :)

CGTalk Moderation
01-14-2008, 01:31 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.