[PD-dev] how do I get my containing canvas? [solved]
Claude Heiland-Allen
claudiusmaximus at goto10.org
Sat Mar 24 22:00:35 CET 2007
Rich E wrote:
> I've been using a block of code I found in the [textfile] and [msgfile]
> externals:
[snip]
> dirname = canvas_getdir(x->canvas)->s_name; // of type t_canvas
[snip]
> Hope this helps,
Well, it helped a little indirectly as it showed me to look for where
x->canvas was initialized, and I found one example here:
static void *qlist_new( void)
{
....snip....
x->x_canvas = canvas_getcurrent();
....snip....
}
I think I'll be doing that in my external's _new function, and use the
canvas I get from canvas_getcurrent() with canvas_open().
canvas_getcurrent() is only valid in the _new function, I assume?
> rich
Thanks,
Claude
>
> On 3/23/07, Claude Heiland-Allen <claudiusmaximus at goto10.org> wrote:
>>
>> Steffen wrote:
>> > On 22/03/2007, at 23.41, Roman Haefeli wrote:
>> >
>> >> When opening patches by sending messages to pd, the path is
>> >> relative to
>> >> pd's startup-location. when loading other files (text-, audio-,
>> >> data-files etc) the path is set relative to the location of the patch.
>> >> since the patch doesn't know, where pd was started, you actually
>> >> cannot
>> >> use relative pathes when opening patches by messages without:
>> >
>> > Maybe [declare] can help you? (Pd >= 0.40)
>>
>> (Maybe) relatedly:
>>
>> How would I open a file relative to a patch in an external instantiated
>> within that patch?
>>
>> canvas_open() seems to be exactly what I want, but how to get the
>> containing canvas of my object?
>>
>> Hoping there is a solution,
>>
>>
>> Claude
>> --
>> http://claudiusmaximus.goto10.org
More information about the Pd-dev
mailing list