AW: how to adress the object name and not the number?
Tiemo Hollmann TB
toolbook at kestner.de
Fri Apr 20 02:30:05 EDT 2007
Good point Bill. Thanks for sharing!
Tiemo
> -----Ursprüngliche Nachricht-----
> Von: use-revolution-bounces at lists.runrev.com [mailto:use-revolution-
> bounces at lists.runrev.com] Im Auftrag von Bill Marriott
> Gesendet: Freitag, 20. April 2007 02:14
> An: use-revolution at lists.runrev.com
> Betreff: Re: how to adress the object name and not the number?
>
> The recommendation to name objects starting with a letter and then a
> number
> is simply a "must" because as others have pointed out there can be
> ambiguity
> when referencing objects named with simply a number. Two additions to the
> excellent ideas:
>
> 1) Remember that the object number always refers to its layer. Lower-
> numbers
> are below higher-numbered ones.
>
> 2) I have found it very helpful to insert a space before the prefix and
> the
> number when naming objects sequentially -- e.g.: "Cell 1" rather than
> "Cell1" -- because then it's a lot easier to find out what number you've
> given that object using Rev's "word" chunk later on.
>
> For example, suppose you've created an array of fields this way:
>
> put "Qty,Part Number,Description,Unit Price,Extended Price" into
> theHeaders
> repeat for each item columnName in theHeaders
> repeat with i = 1 to 20
> put columnName && i into thisCell -- the && concatenates with a
> space
> between
> create fld thisCell
> set the rect of fld thisCell to \
> startLefts[columnName],rowHeight *
> (i-1),startLefts[columnName]+colWidths[columnName],rowHeight * i
> set the lockText of fld thisCell to true
> end repeat
> end repeat
>
> (Leaving out setup of the arrays) Then, when someone clicks on one of the
> cells, you can hilight the entire row very simply with this script in the
> group:
>
> on mouseup
> put the last word of the short name of the target into theLine
> repeat for each item columnName in theHeaders
> put columnName && theLine into thisCell
> set the backgroundColor of fld thisCell to yellow
> end repeat
> end mouseup
>
> or, less verbosely,
>
> on mouseup
> repeat for each item c in theHeaders
> set fillBack of fld (c && last word of short name of target) to
> yellow
> end repeat
> end mouseup
>
> By using "the last word" you've gotten the number of the corresponding
> elements painlessly.
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list