Labels and CSS

Geyser is an object oriented framework for creating, updating and organizing GUI elements within Mudlet.
Post Reply
Narnai
Posts: 7
Joined: Fri Mar 20, 2015 9:35 am

Labels and CSS

Post by Narnai »

Hi, hello.

So, I've made a chat window using Geyser; I have 5 different labels that when clicked, they switch the whole thing to their respective miniconsole - awesome. I've been using label.setStyleSheet to style them and all labels look the same, but I want to change, lets say, the colour of the border of the one that's clicked on. Also, when another label is clicked, I'd like the colour of the first one to go back to its original colour.
I found a way to do that, but it involves changing StyleSheets of all labels each time new label is clicked and it all looks pretty messy and honestly, it seems like that's the most complicated way to do something so simple.

My question here being: is there a another way to do that?

User avatar
Akaya
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

Re: Labels and CSS

Post by Akaya »

I would check out Vadi's CSS Manager. You can find it here

User avatar
Angie
Posts: 51
Joined: Fri May 02, 2014 11:43 pm

Re: Labels and CSS

Post by Angie »

You don't need to change style for all labels, just the newly clicked one and the one that was active before. I have a similar function that looks like this:
Code: [show] | [select all] lua
function tab_menu(clicked_tab)
	if CURRENT_TAB ~= clicked_tab then
		hideWindow("GUI.Tab"..CURRENT_TAB)
		showWindow("GUI.Tab"..clicked_tab)
		setLabelStyleSheet("GUI.TabMenu"..CURRENT_TAB, [[ CSS for inactive tab ]])
		setLabelStyleSheet("GUI.TabMenu"..clicked_tab, [[ CSS for active tab ]])
		CURRENT_TAB = clicked_tab
	end
end
Angie @ Midnight Sun 2
Alayla @ God Wars 2

Post Reply