Binary String to Enable Objects
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Sat Nov 19 10:08:07 EST 2005
Hi Alex,
Perfect.
Of course we have to use (char i of tBinStr = 1) and not item!
I use too the method that consists in naming controls with an
incremental suffix.
But I think that IDs, since they can never change, might be the more
secure solution... but it supposes to build the GUI properly ;-)
Best Regards from Paris,
Eric Chatonet.
Le 19 nov. 05 à 15:57, Alex Tweedly a écrit :
> Eric Chatonet wrote:
>
>> Hello X,
>>
>> The best way (for me :-) should be to set the altIDs of the 32
>> controls in reference to the binary list (or use the IDs directly
>> if they match the right sequence):
>> Then, for instance, if IDs (or altIDs) are 2001 to 2032:
>>
>> local tBinStr -- your binary string
>> -----
>> lock screen
>> repeat with i = 1 to 32
>> set the enabled of control ID (i + 2000) to (item i of tBinStr = 1)
>> end repeat
>> unlock screen
>>
> That's neat ! I would never have thought of using the IDs - I've
> never set an ID to a specific value, but I'll probably remember to
> consider this idea now - thanks.
> I would have done something rather less robust, such as naming the
> controls something like Bit1, Bit2, ... Bit32 and used something like
> set the enabled of control tControlName to ...
>
> btw I think the string is a text string representing a binary
> number, so it would actually be
> set the enabled of control ("Bit" & i) to (char i of tBinStr =
> "1")
>
> (Or, if the controls needed to have meaningful names for other
> purposes, then I'd have used an array or customproperty to map
> numbers to control names).
>
>> Hope this helps.
>>
>> Le 19 nov. 05 à 12:33, Camm29 a écrit :
>>
>>> I have a Binary String say "00001100101011011100101010101010"
>>> I then wish to enable or disable upto 32 Objects depending on
>>> "0" or "1" of the String.
>>> Each bit being alloacated to a a different Object.
>>> Is there an easy way !
>>
>>
>> Best Regards from Paris,
>>
>> Eric Chatonet.
----------------------------------------------------------------
So Smart Software
For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch
Free plugins and tutorials on my website
----------------------------------------------------------------
Web site http://www.sosmartsoftware.com/
Email eric.chatonet at sosmartsoftware.com/
Phone 33 (0)1 43 31 77 62
Mobile 33 (0)6 20 74 50 86
----------------------------------------------------------------
More information about the use-livecode
mailing list