Message sent when object placed onto card
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Message sent when object placed onto card
Hello,
Is a message sent to the card when an object is placed on the card? Like when a new field or button is added? I need to grab the object ID of the newly added object.
Thanks
M
Is a message sent to the card when an object is placed on the card? Like when a new field or button is added? I need to grab the object ID of the newly added object.
Thanks
M
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Message sent when object placed onto card
NO, no message is sent.
BUT, if you do this:
you will get what you need.
BUT, if you do this:
Code: Select all
put the id of the last control
Re: Message sent when object placed onto card
The message(s):
newcard
newbutton
newfield
etc.
is/are sent to the newly created object, so you could "catch" that in your card script.
newcard
newbutton
newfield
etc.
is/are sent to the newly created object, so you could "catch" that in your card script.
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: Message sent when object placed onto card
You guys are a great tag team
on newWidget
put the id of the last control into NewWidgetID
end newWidget
should be just the fix I was looking for!!
Thank you!
on newWidget
put the id of the last control into NewWidgetID
end newWidget
should be just the fix I was looking for!!
Thank you!
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Message sent when object placed onto card
There are at least a dozen "new..." messages sent whenever anything, er, new is created. They are invaluable. Look up "new" in the dictionary for a complete list.
Craig
Craig
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: Message sent when object placed onto card
Thanks Craig.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: Message sent when object placed onto card
Hi Klaus, is it possible to do this "catch" thing in pointer mode? If so, script in card or somewhere else?
Thanks
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: Message sent when object placed onto card
Hi Craig, I am presuming (based on some experiments) that these messages are not sent up the message path to the card in pointer mode? Which leads to a broader question, are any messages sent in pointer mode? (and to clarify, I am referring to drag/drop actions from the tools palette).
Cheers,
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: Message sent when object placed onto card
Hi Mark,
just made a test:
Created a new stack with an opaque graphic, because a "naked" card does not accept any DRAG_XXX message.
Added this script:
Then I used the message box in POINTER mode :
and got the seconds.
Then I dragged a file onto the card, still in POINTER mode and saw the PLUS cursor.
I think the LC tools palette also works with DRAG_XXX messages.
Hope that will answer your questions.
Best
Klaus
P.S.
Not sure, but maybe the IDE will catch the "new_xxxx" messages if you drag'n'drop
an object from the tools palette?
just made a test:
Created a new stack with an opaque graphic, because a "naked" card does not accept any DRAG_XXX message.
Added this script:
Code: Select all
on dragEnter
set the dragaction to "copy"
end dragEnter
on newbutton
put the seconds
end newbutton
Code: Select all
create button in cd 1 of stack "test"
Then I dragged a file onto the card, still in POINTER mode and saw the PLUS cursor.
I think the LC tools palette also works with DRAG_XXX messages.
Hope that will answer your questions.
Best
Klaus
P.S.
Not sure, but maybe the IDE will catch the "new_xxxx" messages if you drag'n'drop
an object from the tools palette?
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Message sent when object placed onto card
I did, AND there seems to be no newControl or newObject,Look up "new" in the dictionary for a complete list.
or, for the sake of argument just new by itself.
THIS, in the cardScript does nothing:
Code: Select all
on newButton
put the name of the last control && the id of the last control
end newButton
Re: Message sent when object placed onto card
Your script in my card shows this correctly in the msg:
button id 1003 1003
macOS 12,6.3 LC 9.6.9 rc2
button id 1003 1003
macOS 12,6.3 LC 9.6.9 rc2
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Message sent when object placed onto card
Works for me as well. How could it not?
Craig
Craig
Re: Message sent when object placed onto card
Yes, Richmond, how could it not?
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Message sent when object placed onto card
Dunno: LC 8.1.10, MacOS 10.7.5
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Message sent when object placed onto card
Richmond.
Posting a tiny stack example is right up your alley.
Craig
Posting a tiny stack example is right up your alley.
Craig