[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Hiding and re-showing a window?



for Cocoa / SCapp this may be a solution without the need of special primitive for the visible_ case (since ObjC bridge is part of SCApp and is very convenient for those kind of thing))

+SCWindow {
asNSObject {
^dataptr.asNSReturn;
}


asNSWindow {
var view, window;
view = this.asNSObject;
window = view.invoke("window"); 
view.release;
^window; // you own it - call release one you do not need it anymore
}


visible {
var ok, nsObj;


if(isClosed, {^false});


nsObj = this.asNSWindow;
ok = nsObj.invoke("isVisible"); 
nsObj.release;


if(ok.isKindOf(Char), {
^(ok.ascii > 0); // 3.3 - BOOL is returned as Char
}, {
^(ok > 0); // post 3.3 - BOOL is returned as Integer
});


^false;
}


visible_ { |yorn|
var nsObj;


if(isClosed, {^this});


nsObj = this.asNSWindow;
if(yorn, {
this.front;
}, {
nsObj.invoke("orderOut:", [nil], true);
});
nsObj.release;
}


unminimize {
this.front;
}
}

best,
charles



Le 8 mai 09 à 16:21, nescivi a écrit :

On Friday 08 May 2009 08:00:33 James Harkins wrote:
> On May 8, 2009, at 5:35 AM, Sciss wrote:
> > if you use visible_ instead of show and hide, it would be
> > compatible with swingosc
>
> Um, no.
>
> + SCWindow {
> unminimize {
> "SCWindow.unminimize : not yet working".error;
> }
>
> visible_ { arg boo;
> "SCWindow.visible_ : not yet working".error;
> }
> }

If there is a working method of visible, we can throw that one out.

sincerely,
Marije