Reply to topic  [ 5 posts ] 
correct syntax for window,1,parent=id ? 
Author Message

Joined: Thu Aug 16, 2007 12:28 pm
Posts: 9
Post correct syntax for window,1,parent=id ?
Hello,
After reading the window function docs,
I tried to use the child/parent relationship to get a 2nd window as an offset from the first with this line:

window,0;plg,indgen(20)(::-1); window,1,parent=0,xpos=500,ypos=500;plg,indgen(20);


Both windows were at the same position.
I search the forum for both xpos and parent without finding another post on this topic. Has anyone got this working ?

Thx,
Ira


Fri Apr 06, 2012 7:20 am
Profile
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post Re: correct syntax for window,1,parent=id ?
The parent=id keyword accepts the window id of the parent window. Under X11, this is the X window id. There is no way to get this number within yorick itself; it bears no relationship to the yorick window number. Certainly parent=0 will never work. The intent is, that if you have a completely different application (for example, a tcl/tk window), you can get a window id for a blank window in that application, and draw to it in yorick. (See, for example, the GUI in yao.)

Even if you did get the window id of a yorick graphics window, inserting a second window inside it will not function properly -- it's not designed to do that. If you want additional coordinate systems, you can create them by creating your own graphics style with multiple systems that you switch among using the plsys command. See style.i and g/work.gs, g/work2.gs, etc. This is terrribly inconvenient, and I don't recommend it. None of this does you much good; you are almost certainly better off just popping up multiple windows for interactive use, and using the png or pdf or eps commands to create pictures that you import into office or desktop publishing software. You can combine and annotate yorick plots there much more easily than within yorick.

If you want to develop a GUI within yorick, you are again better off (for now, at least) going outside yorick; see, for example, yao, which uses python gtk. (That's why the parent=id feature was added.)


Sat Apr 07, 2012 8:02 am
Profile

Joined: Thu Aug 16, 2007 12:28 pm
Posts: 9
Post Re: correct syntax for window,1,parent=id ?
Hello,

My goal was an independent window whose position on the screen was relative to the first.
I'd be just as happy with setting a window's absolute position when I open it; The [x/y]pos keywords
seemed a good candidate. .

Thanks for the reply.


Sun Apr 08, 2012 6:27 am
Profile
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post Re: correct syntax for window,1,parent=id ?
Unfortunately, each of yorick's windows is independent. Under X11, an application doesn't get to specify where its top level windows get placed on the screen; the most it can do is to offer suggestions to the window manager. The idea was that the user, not the application programmer, will place top level windows wherever they please. X11 window managers have exploded in complexity in the last five or ten years, so that the original "hints" you could supply about placement and so on are either ignored or irrelevant in this age of compositing. For example, very frustratingly, yorick's hint to the X11 window manager that its graphics windows should never be given keyboard focus is now ignored almost universally, so that whenever you click on a yorick graphics window, it steals the keyboard focus from the terminal window where you need to type commands. It's very frustrating, but there isn't anything I can do about it.

If you want to use the parent= keyword, you need some other application to create a window for you. For example, in one terminal, you can start a wish shell, and use the tcl/tk winfo command to find the id of the wish window:
Code:
terminal1> wish
% winfo id .
0x2800003
%

Next, in another terminal, start yorick. Drag the wish window out to a larger size, and in the yorick terminal type:
Code:
terminal2> yorick
> window,parent=0x2800003

You can create as many yorick windows inside the wish window as you like, and place them using xpos and ypos.

You can also do something similar within yorick itself by defining a graphics style (with style.i or by customizing g/work2.gs in your own ~/gist directory), and using the plsys command to switch among coordiante systems, instead of the window command to switch among windows.

None of this is particularly convenient or works particularly well. In practice, you are better off spending a second or two arranging your yorick windows, or programming your window manager to arrange them the way you like (a task which your window manager may or may not make easy - in most modern ones, it's nearly impossible).


Sun Apr 08, 2012 10:20 am
Profile

Joined: Thu Aug 16, 2007 12:28 pm
Posts: 9
Post Re: correct syntax for window,1,parent=id ?
It turns out that matlab's figures under linux allow direct placement:
http://www.mathworks.com/help/techdoc/c ... 40107.html
I don't know if they are using X11.

OTOH, your wish trick works rather well.
one call to wish (maybe with yorick's popen) and I can setup a custom tiling of windows under that parent window).

Thank you,


Sun Apr 08, 2012 1:22 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.