Set The Menu Items of an Option Menu (script)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Set The Menu Items of an Option Menu (script)
I must be doing something wrong
So I did as you said and set a custom property..
On field I have
Set the lastLineClicked of me to word 2 of the clickLine
Card
On clearPilot
Delete line lastLineClicked of field "Pilots"
end clearPilot
All triggered by button
Using mouse up to clearPilot
Getting an error on the Delete line in the card script..
So I did as you said and set a custom property..
On field I have
Set the lastLineClicked of me to word 2 of the clickLine
Card
On clearPilot
Delete line lastLineClicked of field "Pilots"
end clearPilot
All triggered by button
Using mouse up to clearPilot
Getting an error on the Delete line in the card script..
Re: Set The Menu Items of an Option Menu (script)
I think I just remembered something from the beginners course..
Customer properties are not compatible with chunk expressions..should work if I place it into variable first then apply chunk expression..
Is this correct?
Customer properties are not compatible with chunk expressions..should work if I place it into variable first then apply chunk expression..
Is this correct?
Re: Set The Menu Items of an Option Menu (script)
Nope that wasn't it..
I'm confused..I can see the custom property updating on the field when impress it...
I'm confused..I can see the custom property updating on the field when impress it...
Re: Set The Menu Items of an Option Menu (script)
Yay got it..
Only Gould get to work if I wrote it to variable in the card script and then deleted based upon that variable..
Thanks for alls help
Only Gould get to work if I wrote it to variable in the card script and then deleted based upon that variable..
Thanks for alls help
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Set The Menu Items of an Option Menu (script)
This will work. You may have done "something wrong" in that you missed the syntax just a bit. You wrote:
On clearPilot
Delete line lastLineClicked of field "Pilots" --NOT CORRECT
delete line the lastLineClicked of field "pilots" of field "pilots" --CORRECT
end clearPilot
Seem odd? It isn't. Think about how this is resolved. The "delete" command needs a value and a target, as in: delete line 2 of field "pilots"
The "2" comes from "the lastLineClicked of field "pilots". See? This string contains the information required to get that "2".
But then where to delete from? You need to tell it "of field pilots". Do not be confused by the repetition of the clause. You will get used to it, and it makes sense.
Write back if this is not clear. You will find this sort of construction all the time; it is not silly or redundant, it is a result of LiveCode being able to process based on properties, which is a very powerful too. But it does seem to be peculiar in the way it reads sometimes.
Craig Newman
On clearPilot
Delete line lastLineClicked of field "Pilots" --NOT CORRECT
delete line the lastLineClicked of field "pilots" of field "pilots" --CORRECT
end clearPilot
Seem odd? It isn't. Think about how this is resolved. The "delete" command needs a value and a target, as in: delete line 2 of field "pilots"
The "2" comes from "the lastLineClicked of field "pilots". See? This string contains the information required to get that "2".
But then where to delete from? You need to tell it "of field pilots". Do not be confused by the repetition of the clause. You will get used to it, and it makes sense.
Write back if this is not clear. You will find this sort of construction all the time; it is not silly or redundant, it is a result of LiveCode being able to process based on properties, which is a very powerful too. But it does seem to be peculiar in the way it reads sometimes.
Craig Newman
Re: Set The Menu Items of an Option Menu (script)
Yeah that is spot on..
It didn't seem correct me repeating so I put into a variable so it made more sense to me..
I ended up with.....
Put lastLineClicked into tDeleteLine
Delete line tDeleteLine of field "Pilots"
But in hind sight
Could have used....
Delete line lastLineClicked of field "Pilots" of field "Pilots"
Confusing but I do get it now..thanks so much mate...
It didn't seem correct me repeating so I put into a variable so it made more sense to me..
I ended up with.....
Put lastLineClicked into tDeleteLine
Delete line tDeleteLine of field "Pilots"
But in hind sight
Could have used....
Delete line lastLineClicked of field "Pilots" of field "Pilots"
Confusing but I do get it now..thanks so much mate...
Re: Set The Menu Items of an Option Menu (script)
Hi Kia,
if you set some parens or slice it into little bits, this is not too irritating!
And please use the THE keyword when accessing custom properties!
...
put the lastLineClicked of field "Pilots" into tLine2Delete
## Will give you a NUMBER that you now can use in your next statement:
delete line tLine2Delete of fld "Pilots"
...
Now if you set parens, you will see that this is the way this will be interpreted by the engine:
...
delete line (THE lastLineClicked of field "Pilots") of field "Pilots"
...
The expression in parens will be solved first and then the rest of the line!
As you see, not really irritating, but extremely logical and reproducable
Best
Klaus
if you set some parens or slice it into little bits, this is not too irritating!
And please use the THE keyword when accessing custom properties!
...
put the lastLineClicked of field "Pilots" into tLine2Delete
## Will give you a NUMBER that you now can use in your next statement:
delete line tLine2Delete of fld "Pilots"
...
Now if you set parens, you will see that this is the way this will be interpreted by the engine:
...
delete line (THE lastLineClicked of field "Pilots") of field "Pilots"
...
The expression in parens will be solved first and then the rest of the line!
As you see, not really irritating, but extremely logical and reproducable
Best
Klaus