Page 1 of 1

How to use Switches to change the bitmap of a CustomButton

Posted: 17 Jan 2013 23:55
by Jeshua
I have 4x2 switch object that I want to use to change a CustomButton's bitmap offstate to four different symbols according to which switch is on.

How would I make this script?

Thank you :)

Re: How to use Switches to change the bitmap of a CustomButt

Posted: 18 Jan 2013 09:59
by Softcore
And what do you want to happen when no switch is on (out of the 4x2 ones) OR when more than two buttons are on?

Re: How to use Switches to change the bitmap of a CustomButt

Posted: 18 Jan 2013 10:04
by Softcore
here's an example with the modifier switches set to radio.....The first one "resets" the custom button to display text, the rest set to a few example bitmaps (out of the 14 range)....
changingbitmaps.jzml
(2.78KiB)Downloaded 132 times

Re: How to use Switches to change the bitmap of a CustomButt

Posted: 18 Jan 2013 10:21
by Phil999
you call up the 'bitmap' attribute of the CustomButton. Something like this:

Code: Select all

decl i=firstof(Switches.x);

setattribute(CustomButton, 'bitmap', i);
Thanks for the idea, I wasn't aware of this bitmap attribute.

Ups, Softcore was faster. :D

Re: How to use Switches to change the bitmap of a CustomButt

Posted: 18 Jan 2013 10:29
by Softcore
Answering posts like this = the best exercise for learning Lemur! ;)

...or should I say:

On expression forum question, any

Code: Select all

decl learn, try;
try = make a sample project;

if (try==1) learn=1;
else learn=0;
lol lol lol lol lol lol

Re: How to use Switches to change the bitmap of a CustomButt

Posted: 18 Jan 2013 10:37
by Macciza
Hi
getattributelist(object) is a handy one to just chuck in a monitor to check whats possible whilst coding . .
Or print out the appendix bits from the guide as well . . .
I keep meaning to post my attribute lister thing . . .
MM

Re: How to use Switches to change the bitmap of a CustomButt

Posted: 18 Jan 2013 10:42
by Softcore
I keep going back to the manual for the attributes - just followed your advice and made a Monitor module with the getattribute script to have ready to drop in future designs and get the attributes of an object fast!

Nice one!

Re: How to use Switches to change the bitmap of a CustomButt

Posted: 18 Jan 2013 10:53
by Phil999
Macciza wrote:Hi
getattributelist(object) is a handy one to just chuck in a monitor to check whats possible whilst coding . .
I wasn't aware of that one either.

Cool stuff, thanks!

Re: How to use Switches to change the bitmap of a CustomButt

Posted: 18 Jan 2013 20:26
by Jeshua
Worked like a charm folks. I'll bring the questions if you guys supply such great answers ;) .