| Batuhan,
Cocoa only, if you want to hide the window you can try that (should work)
( w = SCWindow("my name is... panel", Rect(128, 64, 340, 360));
32.do({ arg i; b = SCButton(w, Rect(rrand(20,300),rrand(20,300), 75, 24)); b.states = [["Start "++i, Color.black, Color.rand], ["Stop "++i, Color.white, Color.red]]; }); w.front; )
a = SCNSObject.newFromRawPointer(w.slotAt(0)); b = a.invoke("window"); a.release; // release a b.invoke("orderOut:", [b], true); // hide
b.invoke("orderFront:", [b], true); // show b.release; // release it when you do not need to hide it again...ect...
Wrapped up fast - checking for isVisible may be better ...ect...
+SCWindow { asNSWindow { var view, window; view = SCNSObject.newFromRawPointer(dataptr); window = view.invoke("window"); view.release; ^window; // you own it - call release one you do not need it anymore }
hide { var nsObj; nsObj = this.asNSWindow; nsObj.invoke("orderOut:", [nil], true); nsObj.release; }
show { var nsObj; nsObj = this.asNSWindow; nsObj.invoke("orderFront:", [nil], true); nsObj.release; } }
( w = SCWindow("my name is... panel", Rect(128, 64, 340, 360));
32.do({ arg i; b = SCButton(w, Rect(rrand(20,300),rrand(20,300), 75, 24)); b.states = [["Start "++i, Color.black, Color.rand], ["Stop "++i, Color.white, Color.red]]; }); w.front; ) w.hide; // hide w.show; // show
best, charles Le 7 mai 09 à 22:14, Batuhan Bozkurt a écrit : Hi James, I've completely disregarded alpha because well, I thought when alpha is 0, the window is still there and thought it would respond to clicks and I'll have code windows floating around, so I thought it would interfere, but trying it now, seems that when alpha is 0 there is this exception that the window does not respond to clicks (i.e. never becomes the front window) so I can access other code windows without the zero alpha window getting on my way (I'm not really sure now if that is reliable though, is this a "feature"?). It is still there in expose etc. (invisible but space is reserved) but I can live with that I guess... If there is a better way of doing it I'm always interested though... Thanks, Batuhan On May 7, 2009, at 8:45 PM, James Harkins wrote: Actually there could be a cross-platform issue here. I think the alpha
trick works on mac, but not SwingOSC. For SwingOSC:
w.visible = false;
w.visible = true;
Not sure if SCWindow supports visible_.
hjh
PS Yes, once you close a window, it's gone. w.close is permanent.
On Thu, May 7, 2009 at 2:40 PM, James Harkins <jamshark70@xxxxxxxxx> wrote:
Set the window's alpha to 0? Then back to 1 when you need it again.
hjh
On Thu, May 7, 2009 at 3:39 PM, Batuhan Bozkurt
<batuhan@xxxxxxxxxxxxxxxxxx> wrote:
Hi all,
Stuck on something very fundamental, I can't really see how I haven't needed
this before but, how should I go for hiding a window to be able to reopen
it later on without creating a new Window, with its state intact (i.e.
without reinitializing the window and widgets, the ones which I use now are
actually subclasses of the standard widgets and they have their own private
states)? I know this is also a question of design, but for now, I'd be
really happy if I could just close a window (or hide it) and reopen it as if
it was always there, just by rendering it invisible then visible... I've
ditched the docs and the archives but couldn't find a mention of it at all.
Now seems like once I close the window, its gone forever... Any pointers?
--
James Harkins /// dewdrop world
jamshark70@xxxxxxxxxxxxxxxxx
http://www.dewdrop-world.net
"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal." -- Whitman
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________ sc-users mailing list info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtmlarchive: https://listarc.bham.ac.uk/marchives/sc-users/search: https://listarc.bham.ac.uk/lists/sc-users/search/
|