Jump to content
Sign in to follow this  
dreadedentity

Change Active Background Color in Dialog

Recommended Posts

Hello,

I am making a dialog, well, I guess I should say I have made a dialog. Anyway, I'm messing around with my listbox base class, trying to find the correct attribute that changes the background color of the active selection, which one is it?

While I'm at it, I want to make it so if a user clicks on a different element, the other dialog elements lose their active state, how can I do that? (ie. I have a few listboxes, if somebody clicks on one, then clicks on another one, they both show active selections, I want the original one to be de-selected)

Thanks,

DE

Share this post


Link to post
Share on other sites

Hi mate,

Try this:

colorBackgroundActive[] = {your 4 numbers};

For part 2, you could attach a "MouseExit" EH to disable a list of IDC's when the mouse leaves the area

https://resources.bisimulations.com/w/index.php?title=VBS2:_User_Interface_Event_Handlers

Might be on scripter channel later so maybe speak then :)

Share this post


Link to post
Share on other sites

Thanks for that Das, I'm looking into disabling the IDC's now but the colorBackgroundActive didn't seem to work. See you soon

---------- Post added at 18:14 ---------- Previous post was at 18:10 ----------

Here it is, I found what I was looking for after days of frantic searching. The attribute I was looking for is called colorSelectBackground, for anyone else wondering

Share this post


Link to post
Share on other sites

Sorry mate, I'm half asleep today, the EH should have been "MouseButtonClick" or maybe "MouseButtonDown". Glad you got your other bits and bobs sorted.

Share this post


Link to post
Share on other sites
(ie. I have a few listboxes, if somebody clicks on one, then clicks on another one, they both show active selections, I want the original one to be de-selected)
You could use on LBSelChanged, so when someone selects an item in the listbox you change all others to a selected index of -1.

Something like...

//Call from the displays onLoad
display = _this;

//List of listbox IDCs
LB_IDCs = [ 1000, 1001, 1002, 1003 ];

{
//Add a selection change to each LB
( display displayCtrl _x ) ctrlAddEventHandler [ "LBSelChanged", {
	//Get the selected LB
	_selectedLB = _this select 0;

	{
		//If not the selected LB then change the selection to nothing
		if ( !_x == ctrlIDC _selectedLB ) then {
			lbSetCurSel [ _x, -1 ];
		};
	}forEach LB_IDCs;
}];

}forEach LB_IDCs;

Edited by Larrow

Share this post


Link to post
Share on other sites

Thanks for that, Larrow. I thought this way might work so I did some testing, but in my tests, it seems that setting -1 will not remove the active selection. See my note at the bottom of lbSetCurSel. Also, good to see you back here, outstanding advice as always

Share this post


Link to post
Share on other sites
Thanks for that, Larrow. I thought this way might work so I did some testing, but in my tests, it seems that setting -1 will not remove the active selection. See my note at the bottom of lbSetCurSel. Also, good to see you back here, outstanding advice as always
If you clear out the listbox then set current index to -1 and refill it, it works. Without using LBSetCurSel to -1 before refilling it retains its old selection index.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×