Greetings. I'm trying to find a way to fetch the position of a slider object. I see that canvas has a get_pos
message it can receive. Is there something similar to this for other objects? I am new to the GUI side of PureData. Thanks in advance
-
get position of slider
-
@whale-av Thank you for the help! That is too bad but I'll figure out a way to workaround the limitation. Part of the fun I suppose
-
The iemguts external library can possibly handle this.
-
@alexandros I didn't see much available for getting information from sliders and such with iemguts abstractions, but maybe there's something included in iemguts that I'm not seeing?
-
@lo94 You can set absolute positions for the GUI's (see the help) and then you know where they are and can keep track in the patch. You can also move them to a relative position with a delta message, and it will be only marginally more difficult to keep track.
You can also set other properties with messages to the tcl code used by the drawing program "wish" that Pd uses.
You will need [sys_gui] from the hcs library for that.
David. -
@lo94 you can put a slider inside a subpatch with graph-on-parent and put a [canvasposition] in there too. Then add some [send]s and [receive]s to be able to bang [canvasposition] and get its output. You can probably make an abstraction with this and be able to querry the position of any abstraction with a bang.
-
@lo94 here are the basics for using iemguts, downside is that you have to set properties through messages and you will need to save and restore those settings with [savestate]. This uses a little dynamic patching so you can also get_pos by sending to it and not just from the inlet. A vanilla way would be essentially this same patch but instead of sending a bang to [canvasposition] when it receives [get_pos( you just send it too a canvas which the vsl is sitting on top of. This canvas just needs it top left corner aligned with the top left corner of the vsl and just needs to be smaller than the width of the vsl.
It is also possible to use [iemguts/canvasobjectposition] if you know the vsl's object number, simplest way is just to make sure the vsls which you want the position of are the first objects, so before you save you copy and cut everything but the vsls and then paste everything back in, if you have 6 vsls your vsls will now be objects 0 through 5, and sending those numbers to [canvasobjectposition] will get you their position.
vsl+.pd
Edit:forgot the patch. -
The [get_pos( message works from a parent patch in a sub-patch or abstraction with graph-on-parent, too: Moving the child, returns its' position in the parent. Just put the slider on top of the canvas.
openthis_parent.pd
canvas-test.pd -
Thanks so much for the detailed replies everyone! I'm looking forward to sitting down with this tomorrow after work I think the approach using the [iemguts/canvasobjectposition] fits my use case best, as I actually designed a little editor to speed up prototyping controllers/synths for use in PDParty. Being it has undo functionality, so it keeps track of order of creation and all dynamically called commands, this should actually be quite painless. Thanks a bunch @oid. Perfect solution that I needed
-
This post is deleted!