Page 1 of 1

not finding 'of'

Posted: Thu Apr 23, 2020 2:02 pm
by AGC studios
Hi, I'm running this code:

Code: Select all

   if the label of button convertFromOptionMenu is "Please choose."
   then                                                            
      return ("Please choose.")
  end if
For some reason LiveCode is returning error:
Compilation error at line 11: (Properties expecting ‘of’) near “label”, char 7
I don’t get why its giving me this error.
I tried rewriting it etc.
I'm running LC 9 .5 .1 on windows 10
Any ideas?

Re: not finding 'of'

Posted: Thu Apr 23, 2020 3:25 pm
by jmburnod
Hi,
Quickly:

Code: Select all

function  testLabel 
   if the label of button convertFromOptionMenu is "Please choose."    then  
      return "Please choose."
   else
      return "label is not = Please choose."
   end if
end testLabel
Best regards
Jean-Marc

Re: not finding 'of'

Posted: Thu Apr 23, 2020 3:45 pm
by AGC studios
hi, I was probably not clear… the problem is that LC is throwing me an error for not putting ‘of’ after label even though its written…
sorry for not being clear, and thanks for your answer

PS
I have run this code about a month now, and I didn’t do any changes and suddenly its throwing me this error

Re: not finding 'of'

Posted: Thu Apr 23, 2020 3:49 pm
by richmond62
I think your problem is a "problem":

Code: Select all

if the label of button "convertFromOptionMenu" is "Please choose."

Re: not finding 'of'

Posted: Thu Apr 23, 2020 3:57 pm
by Klaus
Nope, not putting NAMES (object- and filenames) into quotes is just "sloppy" scripting, but the engine usually does not complain! 8)

The syntax is definitively correct, did you quit and restart LC and/or your machine?
Often these kind of non-errors will go away then.

Re: not finding 'of'

Posted: Thu Apr 23, 2020 4:00 pm
by dunbarx
Richmond.

Certainly good practice dictates that quotes be used as you stated. But LC, like HC before it, is loosey goosey about this, as you know. Unless there is a name conflict, LC will "find" the unquoted button.

I suspect, again assuming no conflict, that something else is amiss.

Craig

Re: not finding 'of'

Posted: Thu Apr 23, 2020 4:24 pm
by jacque
Jean-Marc's example has moved "then" to the end of the first line rather than putting it on the next line. LC is very flexible about this and your method should work, but try moving it to see if that helps.

Re: not finding 'of'

Posted: Thu Apr 23, 2020 5:08 pm
by Thierry
dunbarx wrote: I suspect, again assuming no conflict, that something else is amiss.
Good catch Craig :)

I do believe, as your button name is not quoted,
that you have set "Variable Checking" in the SE option.

Either quote the name, or uncheck this option.

SE window active, Menu Edit-> Options -> Variable Checking

sunnYscrrenshot 2020-04-23 à 18.00.40.png

Does it work after that?

Regards,

Thierry

Re: not finding 'of'

Posted: Thu Apr 23, 2020 7:15 pm
by AGC studios
Ok, thanks for your answers
I will try and put the name inside “” I probably missed it
About the then it is on a different line just a problem of copying the code…
I did restart LC and my whole computer…
Ill the name inside “” and see.
THANK YOU VERY MUCH! :D :D

Re: not finding 'of'

Posted: Thu Apr 23, 2020 7:23 pm
by AGC studios
Yes, putting it inside “” works!
It’s weird because I’ve bean running this code for some time now and it didn’t seem to care…
Anyways, thanks

PS
I’ve been finding 9 .5 .1 buggy… where can I report these? Stuff like LC not finishing functions and more (for exm. Function XXX LC some decides not to do end XXX)

Re: not finding 'of'

Posted: Thu Apr 23, 2020 7:27 pm
by AGC studios
I tried @‘Thierry’ idea and indeed it was on…

Re: not finding 'of'

Posted: Thu Apr 23, 2020 7:27 pm
by Klaus
Bug reports go here: https://quality.livecode.com

Re: not finding 'of'

Posted: Thu Apr 23, 2020 7:58 pm
by bogs
Well, bug reports go there, but is this technically a 'bug' ? After all, AGC studios had variable checking on in the editor, and an unquoted name, which looks to Lc like...like...well, like a variable. Examples might be ..

Code: Select all

button tmpName
button tmpCol
button isThisAbug?!#@
:twisted:

Re: not finding 'of'

Posted: Thu Apr 23, 2020 8:10 pm
by Thierry
bogs wrote:
Thu Apr 23, 2020 7:58 pm
is this technically a 'bug' ? :twisted:
@bogs, agree with you; don't see this as a bug

My thinking came out of this OP statement:
I have run this code about a month now, and I didn’t do any changes and suddenly its throwing me this error
Best,

Thierry