is the name of the selectedObject stored somewhere
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
is the name of the selectedObject stored somewhere
While in the IDE I would like to be able to edit the selectedObject (modify it's properties in script). Is there somewhere to find/retrieve the name of the selectedObject? (PS for those who read Andre's latest book; "Development Oriented Development", he references this function on Pg 24 but I can't figure out how he gets it to work). I've tried putting the name of the "selectedObject" into the msg box, or an answer dialog but I never get anything. However the msg box seems to get and display the name quite handily. Anyone know how it does that? (Hope I haven't asked too many questions!).
Thanks
Mark
Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: is the name of the selectedObject stored somewhere
I don't have the book but you could try
Kelly
Code: Select all
put the long name of the selectedobject
Re: is the name of the selectedObject stored somewhere
Hello, if what you are trying to do is a plugin. I advise you to read this post: https://livecode.com/how-to-create-plug ... e-8-0-ide/.
In it he explains how to subscribe to certain messages from the IDE. Among them to ideSelectedObjectChanged, within can call funcon the selectedobject or the selectedobjects. The last one will have a reference to a selected object on each line.
In it he explains how to subscribe to certain messages from the IDE. Among them to ideSelectedObjectChanged, within can call funcon the selectedobject or the selectedobjects. The last one will have a reference to a selected object on each line.
-
- VIP Livecode Opensource Backer
- Posts: 9709
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: is the name of the selectedObject stored somewhere
Hi.
Kelly nailed this with "the selectedObject". That is just what that function is designed for. In fact, it can return any number of selected objects.
Whatever the message box can do, a handler can do better. Are you sure that when your handler calls this function, that there is indeed an object selected? You will get empty if not. Otherwise it is very straightforward.
And the title of your post is interesting. But in the context of your question, nothing about a selected object is "stored" anywhere, simply by virtue of it being selected. But there is a property of an object that is selected, and is, not surprisingly, known as "the selected". This can be either true or false, depending on, well, I bet you already know. This is a basic underpinning of LiveCode. Properties reflect the current state of everything. They change, and are changed, by the user, the system, whatever. It is the setting and getting of properties that makes the world go round.
You have not asked nearly enough questions. Keep at it.
Craig
Kelly nailed this with "the selectedObject". That is just what that function is designed for. In fact, it can return any number of selected objects.
Whatever the message box can do, a handler can do better. Are you sure that when your handler calls this function, that there is indeed an object selected? You will get empty if not. Otherwise it is very straightforward.
And the title of your post is interesting. But in the context of your question, nothing about a selected object is "stored" anywhere, simply by virtue of it being selected. But there is a property of an object that is selected, and is, not surprisingly, known as "the selected". This can be either true or false, depending on, well, I bet you already know. This is a basic underpinning of LiveCode. Properties reflect the current state of everything. They change, and are changed, by the user, the system, whatever. It is the setting and getting of properties that makes the world go round.
You have not asked nearly enough questions. Keep at it.
Craig
Re: is the name of the selectedObject stored somewhere
This.
If, for instance, you have created your own palette to choose properties to set, or a button to apply properties by running your handler, then you might find the selectedObject is no longer the object you originally selected.
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: is the name of the selectedObject stored somewhere
Thanks everyone. You have given me lots to think about. If I get stuck again I'll post an example.
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: is the name of the selectedObject stored somewhere
Hello marksmithhfx. Create a small sample extension using the LiveCode API. Which was introduced in version 8 and explained in the post I previously shared here.
If you are doing a plugin, which is what I understood. It is better to use this API.
It is a simple and improvable extension. What it does is display the properties of the selected object. As long as the object is not a widget: D.
Happy coding
If you are doing a plugin, which is what I understood. It is better to use this API.
It is a simple and improvable extension. What it does is display the properties of the selected object. As long as the object is not a widget: D.
Happy coding
- Attachments
-
- Plugin Template.rar
- (1.52 KiB) Downloaded 162 times
Last edited by andresdt on Mon Apr 19, 2021 1:23 pm, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: is the name of the selectedObject stored somewhere
Hi Andre, I read the post with considerable interest, and I think you are correct, the mechanism is explained in/by the IDE API. Will give this a try (but I see you've posted a stack so I will be downloading that and giving it a try. Thanks a bunch)!!!andresdt wrote: ↑Fri Apr 02, 2021 4:18 amHello, if what you are trying to do is a plugin. I advise you to read this post: https://livecode.com/how-to-create-plug ... e-8-0-ide/.
In it he explains how to subscribe to certain messages from the IDE. Among them to ideSelectedObjectChanged, within can call funcon the selectedobject or the selectedobjects. The last one will have a reference to a selected object on each line.
Mark
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: is the name of the selectedObject stored somewhere
Hi Andre, I just tried unzipping this and apparently I am not equipped with an un-RAR application. Would you recommend one?andresdt wrote: ↑Fri Apr 02, 2021 1:11 pmHello marksmithhfx. Create a small sample extension using the LiveCode API. Which was introduced in version 8 and explained in the post I previously shared here.
If you are doing a pliugin, which is what I understood. It is better to use this API.
It is a simple and improvable extension. What it does is display the properties of the selected object. As long as the object is not a widget: D.
Happy coding
Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: is the name of the selectedObject stored somewhere
Hello, I am on Win 10 and I use winRAR, here is the same example. Now in a ZIPmarksmithhfx wrote: ↑Tue Apr 06, 2021 3:34 pmHi Andre, I just tried unzipping this and apparently I am not equipped with an un-RAR application. Would you recommend one?andresdt wrote: ↑Fri Apr 02, 2021 1:11 pmHello marksmithhfx. Create a small sample extension using the LiveCode API. Which was introduced in version 8 and explained in the post I previously shared here.
If you are doing a pliugin, which is what I understood. It is better to use this API.
It is a simple and improvable extension. What it does is display the properties of the selected object. As long as the object is not a widget: D.
Happy coding
Thanks
Mark
- Attachments
-
- Plugin Template.zip
- (1.54 KiB) Downloaded 160 times
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: is the name of the selectedObject stored somewhere
Wonderful, thanks.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: is the name of the selectedObject stored somewhere
RAR Extractor Free is in the Mac App Store and worked for me.marksmithhfx wrote: ↑Tue Apr 06, 2021 3:34 pm
Hi Andre, I just tried unzipping this and apparently I am not equipped with an un-RAR application. Would you recommend one?
Thanks
Mark
Kelly
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: is the name of the selectedObject stored somewhere
Thanks!
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: is the name of the selectedObject stored somewhere
Dear @andresdt, thank you for this code - it solved the issue I was just about to grapple with!andresdt wrote: ↑Fri Apr 02, 2021 1:11 pmHello marksmithhfx. Create a small sample extension using the LiveCode API. Which was introduced in version 8 and explained in the post I previously shared here.
If you are doing a plugin, which is what I understood. It is better to use this API.
It is a simple and improvable extension. What it does is display the properties of the selected object. As long as the object is not a widget: D.
Happy coding
This forum is a goldmine
But only thanks to the generosity of developers like yourself - thank you!
Stam