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, [email protected] wrote:
> 
> Message: 3
> Date: Wed, 06 Nov 2024 18:14:10 +0100
> From: IOhannes m zmölnig <[email protected] <mailto:[email protected]>>
> Subject: [PD-dev] Re: help figuring out how to know when in edit mode
>       and setting cursor
> To: [email protected] <mailto:[email protected]>
> Message-ID: <[email protected] 
> <mailto:[email protected]>>
> Content-Type: text/plain; charset=utf-8
> 
> Am 6. November 2024 17:56:32 MEZ schrieb Alexandre Torres Porres 
> <[email protected] <mailto:[email protected]>>:
> 
>> 
>> 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/>
 ---
[email protected] - the Pd developers' mailinglist
https://lists.iem.at/hyperkitty/list/[email protected]/message/DBXNPIV64UOUUWCOB3SPOG7QO5PQYJ3Y/

Reply via email to