[PD-dev] getting canvas pointer from filename

Hans-Christoph Steiner hans at eds.org
Sat Nov 10 18:43:02 CET 2007


On Nov 10, 2007, at 11:36 AM, IOhannes m zmoelnig wrote:

> Hans-Christoph Steiner wrote:
>>
>> If you search all of Austria for "Steiner", you'll get a much  
>> smaller list than 8 million.  So if there are multiples, then  
>> return multiple canvases.  Then I can work on a system to deal  
>> with that.
>
>
> hmm, if i am in a room with you and 3 other people, i would rather  
> not search the NY-phonebook to get your address, but instead talk  
> to you directly.
>
> however, my example with your name was a very bad one regarding the  
> concept of class vs. instance.
> so let's leave it there.
>
>
> i still don't fully understand why you want to do that.
> i mean: why do you want to do it via the class when you have the  
> instances?
> what is wrong if you can get the canvas-pointer of a specific canvas?
> why do you need the canvas-pointer of something that does not have  
> a canvas?

I want to have a way where it's easy for users to find the canvas  
names to send Tcl/Tk messages to them to control their visual  
properties.  It seems to me that using the patchname is the most  
obvious since all Pd users know about that.  If there are multiples,  
then the object could return a list of canvas names.  Then it would  
probably be useful to be able to query the parent of a given canvas  
name.

[tot] can do a lot of this (not all?), but it's syntax is very much  
for the Tcl programmer.  I am making an interface for Pd programmers.

> apart from that: i really would like to have the canvas-name be  
> generated (and hidden) by a function instead of directly using the  
> canvas-pointers whenever you want to construct a message to sys_vgui 
> ().
>
> something like:
>
> t_symbol*canvas_getname(t_canvas*x){
>  t_symbol*s=0;
>  char buf[MAXPDSTRING];
>  snprintf(buf, MAXPDSTRING, ".x%lx", glist_getcanvas(x));
>  buf[MAXPDSTRING-1]=0;
>  s=gensym(buf);
>  return buf;
> }
>
> which could eventually be changed to create more names that are  
> more general (e.g. can be shared between several pd-engines)

I agree, so I did this in externals/bbogart/entry/entry.c.  I am  
going to use this in tkwidget library too.

.hc

------------------------------------------------------------------------ 
----

All information should be free.  - the hacker ethic








More information about the Pd-dev mailing list