Page 1 of 1
Multicolor for rows
Posted: 05 Dec 2016 10:29
by mesquire
Hi all,
This may be something so simple it's escaping my grasp, but I'm having a really hard time trying to write a script to give each row of my switches a different color.
The typical setattribute 'colors' etc is great if you want to do a certain repeating set or columns but doing rows seems more difficult.
Anyone had any luck?
Re: Multicolor for rows
Posted: 05 Dec 2016 17:12
by phase_change
Are you trying to get the entire row the same color or each individual switch? Is it a single row of switches or is it a grid of rows and columns? Could you just use individual switches if you're trying to make each switch a different color and line them so it looks like a row? If you did that you wouldn't need to use set attribute.
Re: Multicolor for rows
Posted: 06 Dec 2016 04:06
by mesquire
I have a large grid of switches which I'm using for program changes. I could make individual switches but that would take so much more work compared to a grid. I don't necessarily need to control the colour of every switch, but I'd like to have the option to colour the rows a different colours so it's not just one block of the same thing.
Re: Multicolor for rows
Posted: 06 Dec 2016 20:39
by MrCorba
I think this is something you're looking for.
This takes two colors, color_odd for the odd rows and color_even for the even rows. It then calculates the number of rows and columns and alternates the color between the rows.
It has comments so you'll probably be able to expand this to other number of colors;)
Cheers!
Re: Multicolor for rows
Posted: 07 Dec 2016 09:57
by oldgearguy
funny, I was just about to upload an example as well.
Since it's done, here you go.
Press and hold the button on the right to set the colors, when you release it, they go back to a default.
The script shows how to manipulate all and also individual cells.
Re: Multicolor for rows
Posted: 07 Dec 2016 12:08
by phase_change
Dang, I was so close. I was trying to set them with setattribute(Switch[0],'colors',blahblahblah);
Re: Multicolor for rows
Posted: 07 Dec 2016 15:57
by oldgearguy
phase_change wrote:Dang, I was so close. I was trying to set them with setattribute(Switch[0],'colors',blahblahblah);
Yeah, you'd think
Code: Select all
setattribute(Switch[0],'color', {background, foreground});
would work to set an individual switch color in the matrix but it doesn't seem to work. It will work to set the overall bg/fg color is you do this:
Code: Select all
setattribute(Switch,'color',{background, foreground});
but as soon as you subscript the switch matrix, Lemur gets confused.
NB - using the
colors attribute implies specifying the background color for all switches in the following value array. The singular
color is for the general overall background and foreground. The side effect is that you can customize the background colors but not the foreground.
Re: Multicolor for rows
Posted: 11 Dec 2016 11:53
by mesquire
Thanks so much for all the help!
You guys are definitely on to something.
Re: Multicolor for rows
Posted: 12 Dec 2016 15:29
by oldgearguy
mesquire wrote:Thanks so much for all the help!
You guys are definitely on to something.
or maybe just on something.
Working with Lemur is a unique experience.
There's usually a way to do what you want, it just may be different than you planned.