The "hacky" way is to send the tk command to change the cursor by name:
https://www.tcl.tk/man/tcl8.6/TkCmd/cursors.htm
You probably need to know which widget ID to configure as well.
But IOhannes is right, you will only end up fighting the built in editor logic on this and this is non portable when we consider other GUI frameworks.
On Nov 7, 2024, at 12:00 PM, pd-dev-request@lists.iem.at wrote:
Message: 3 Date: Wed, 06 Nov 2024 18:14:10 +0100 From: IOhannes m zmölnig <zmoelnig@iem.at mailto:zmoelnig@iem.at> Subject: [PD-dev] Re: help figuring out how to know when in edit mode and setting cursor To: pd-dev@lists.iem.at mailto:pd-dev@lists.iem.at Message-ID: <3C1FEF1E-EFAD-42F5-83DC-4A69EC397EB5@iem.at mailto:3C1FEF1E-EFAD-42F5-83DC-4A69EC397EB5@iem.at> Content-Type: text/plain; charset=utf-8
Am 6. November 2024 17:56:32 MEZ schrieb Alexandre Torres Porres <porres@gmail.com mailto:porres@gmail.com>:
In order to know that Pd is in edit mode I do what I consider an ugly hack, which is listening to all canvas messages and filter the 'edit' message. I think it looks bad in the code and I wonder if there is a simpler way. Or if the way comment works is just something not exposed for externals. And I have the same inquiry for the cursor thing, if I can learn and apply the same mechanism for externals.
Getting the edit mode, should be easy enough: https://github.com/pure-data/pure-data/blob/c2d65103e5c068fa466260480b012ef03aed58a2/src/g_editor.c#L2254
But iirc, there's no proper way for an arbitrary object to receive mouse events while in edit mode. Everything you mentioned is hardcoded in Pd's editor itself.
And the "widgetbehaviour" API is really a prime example of bad design (with respect to extendibility), so it's not easy to change it to make more objects do something class-specific in edit mode, without cluttering rather unrelated code (g_editor), or - possibly - resorting to even uglier hacks
mfg.sfg.jfd IOhannes
-------- Dan Wilcox danomatika.com http://danomatika.com/ robotcowboy.com http://robotcowboy.com/