Upper/Lower case issue

Pete pete at mollysrevenge.com
Sat Jul 2 12:43:17 EDT 2011


Hi Craig,
Just to be clear, the button names are not identical - one is upper case and
one is lower case.  In its wisdom, LC treats them as identical because they
are object names but if those string were not object names, they would not
be treated as identical if casesensitive was true.

Here's what I'm trying to do.

The names of the buttons are strings that define elements of date formats.
 For example, %m means zero suppressed month number and %M means 2-digit
month numbers with leading zero, %d means zero suppressed day number, %D
means 2 digit day number, etc.  This is a very common convention for
defining date strings.

Since those are pretty cryptic strings, I use the button labels to show a
more meaningful description to the user and then store the names of the
buttons (%m, %D, etc) in a date format string in my preferences file.  That
way, I can pass the date definition string directly to my date formatting
handler.  Next time the preferences card is opened, I need to get the
settings from the prefs file and set the appropriate buttons, and that's
where the problem arose.

Here's the code I used to get round the problem.

   *    *

*private command setButtonHilite pgroup, pbutton*
*

   set the casesensitive to true

   repeat with count=1 to the number of buttons in group pgroup

      put the short name of button count of group pgroup into myName

      if myName is pbutton then

         set the hilitedButton of group pgroup to count

         exit repeat

      end if

   end repeat

end setButtonHilite


There are only 2-4 buttons in each group I need to process this way so
there's no performance hit. I suppose I could have used a custom property to
do this but I'd already gone down the path of using the button name before I
discovered the casesensitive issue so opted to stick with that approach.
 Plus I would have needed a similar command to locate the button with the
correct custom property.


Hope that explains the situation


*
Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Fri, Jul 1, 2011 at 10:38 PM, <dunbarx at aol.com> wrote:

> Pete.
>
>
> In the old HC days, before there was a name AND a label, I might have
> understood that you might have a valid reason to use identical names. You
> are aware that these two properties exist, and still have your reasons. Can
> you say briefly what they are?
>
>  I know you said they were too complicated, but just a one or two liner?
>
>
> Craig Newman
>
>
>
>
> -----Original Message-----
> From: Mark Wieder <mwieder at ahsoftware.net>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Sent: Fri, Jul 1, 2011 8:56 pm
> Subject: Re: Upper/Lower case issue
>
>
> Pete-
>
> Friday, July 1, 2011, 4:41:16 PM, you wrote:
>
> > That's OK Mark, I agree with what you said 99.99999% of the time, it's
> just
> > that there is a valid reason for what I'm doing in this particular
> instance.
>
> It seems like you found a way out of your predicament, but I'm still
> with Mark on this. If you think you need to give the same name to two
> buttons there's another way of getting the result you're looking for.
>
> --
> -Mark Wieder
>  mwieder at ahsoftware.net
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>



More information about the use-livecode mailing list