external object with its own window

Luigi Castelli's icon

Hi there,

I am working on an external that is supposed to put up its own window.

I have declared:

x->window = wind_new(x, 0, 0, 400, 200, WCLOSE | WCOLOR);

in myobject_new method. The idea is to start by creating an invisible
window.
When the user double clicks on the object or sends the 'open' message
to the object the window is supposed to become visible. However in some
situations I would like to so some processing on the window such as
moving and resizing, before actually making it visible.

So the order of operations would be:

1 - create an invisible window
2 - move it and resize it (still invisible)
3 - make it visible

Even though it seems like it would be a simple task I can't find a way
to accomplish this.

It seems that the WindowPtr field in the t_wind structure becomes valid
only after calling wind_vis() which makes my window visible. Without
having a valid reference to the OS window I can't do any moving or
resizing (when the window is still invisible that is).

I also tried the syswind API with the following instead of wind_vis:

t_syswind wind = wind_syswind(x->window);
syswindow_show(wind);

but it doesn't seem to work.

What am I missing here ?

Thank you.

- Luigi

------------------------------------------------------------
THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207.
------------------------------------------------------------

Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php

Peter Castine's icon

Hi Luigi,

I tried something similar (though manipulating an object's patcher window, which may be considered an [even more] evil thing to do by those working on Max 5). Anyway, most of the things I tried didn't work... I got the impression that the Max "window" data type didn't actually create manipulatable data until the window was made visible for the first time. So, basically, I couldn't move the window without it flashing first at its default position.

I had written way back when asking for advice, but never got any (or missed any that came back). So, if you figure anything out, I'd be grateful to hear. Otherwise, I'm afraid I don't have a whole lot of suggestions.

Ciao -- P.

Luigi Castelli's icon

Yes, I pretty much had the same experience...

However, it seems very weird to me that there is no way of manipulating
a window without making it visible first. It's such a basic
requirement... So I am thinking I am missing something obvious...

What I have now is something like:

// create invisible window
x->window = wind_new(x, 0, 0, 0, 0, WCLOSE | WCOLOR);

// make it visible
wind_vis(x->window);

// make it invisible
syswindow_hide(wind_syswind(x->window));

// *** manipulate window here... ***

// make it visible again
syswindow_show(wind_syswind(x->window));

// delete window
freeobject((t_object *)x->window);

It would make a lot more sense if I could create the window invisible,
and have a valid reference to it already without the need to make it
visible first, but everything I tried didn't really work.

It would be nice to hear something definitive from the C74 guys.

Thank you.

- Luigi

--- Peter Castine wrote:

>
> Hi Luigi,
>
> I tried something similar (though manipulating an object's patcher
> window, which may be considered an [even more] evil thing to do by
> those working on Max 5). Anyway, most of the things I tried didn't
> work... I got the impression that the Max "window" data type didn't
> actually create manipulatable data until the window was made visible
> for the first time. So, basically, I couldn't move the window without
> it flashing first at its default position.
>
> I had written way back when asking for advice, but never got any (or
> missed any that came back). So, if you figure anything out, I'd be
> grateful to hear. Otherwise, I'm afraid I don't have a whole lot of
> suggestions.
>
> Ciao -- P.
> --
> -------------- http://www.bek.no/~pcastine/Litter/
> -------------
> Peter Castine +--> Litter Power & Litter Bundle for
> Jitter
>
> iCE: Sequencing, Recording & Interface Building for Max/MSP
> Extremely cool http://www.dspaudio.com/
>
>

------------------------------------------------------------
THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207.
------------------------------------------------------------

Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/