Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
monki
- Posts: 59
- Joined: Tue Dec 13, 2011 10:56 pm
Post
by monki » Sun Dec 18, 2011 5:21 am
Code: Select all
on mouseEnter
put long ID of this field into tfieldID
put tfieldID into positonFld
end mouseEnter
This code fails with a " field "txtPreviewFld": execution error at line 2 (Chunk: no such object), char 16 " error.
Any idea what the problem could be? Does "this" only work with cards and stacks?
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Sun Dec 18, 2011 10:23 am
Hi Monki,
Use "the target" instead "this fld" and it work
Code: Select all
on mouseEnter
put long ID of the target into tfieldID
put tfieldID into positonFld
end mouseEnter
Best regards
Jean-Marc
https://alternatic.ch
-
sturgis
- Livecode Opensource Backer

- Posts: 1685
- Joined: Sat Feb 28, 2009 11:49 pm
Post
by sturgis » Sun Dec 18, 2011 10:56 am
If you have a script in an object itself (rather than in a card or stack) you can use the "me" keyword also.
Code: Select all
on mouseEnter
put the long id of me into tFieldID
put tFieldID into positionFld
end mouseEnter
Of course there are more useful examples of "me" like having a button set its own label, or a field setting its own contents or whatever.
Code: Select all
set the label of me to "myNewLable"
jmburnod wrote:Hi Monki,
Use "the target" instead "this fld" and it work
Code: Select all
on mouseEnter
put long ID of the target into tfieldID
put tfieldID into positonFld
end mouseEnter
Best regards
Jean-Marc
-
monki
- Posts: 59
- Joined: Tue Dec 13, 2011 10:56 pm
Post
by monki » Sun Dec 18, 2011 5:12 pm
Thanks for the help guys.
"me" worked sturgis. I though thought I tried that word, but I must have worded something wrong.
I thought that the "me" keyword was originally part of hyperTalk and searched for it in the livecode dictionary, but the search didn't turned up anything. So after reading your post, I manually scrolled the dictionary list and found it that way.
Oh well.
Thanks for the help
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Tue Dec 20, 2011 12:10 am
Hi,
It seem the target is better than me
for a btn:
put me = cd id 1002
put the long id of me = card id 1002 of stack...
put the backgroundcolor of me = empty
Best regards
Jean-Marc
https://alternatic.ch