|
From: | William McBrine |
Subject: | Re: copywin() behaves oddly... can anyone explain? |
Date: | Tue, 8 May 2007 06:04:33 -0400 (EDT) |
On Mon, 7 May 2007, Bryan Christ wrote:
Can anyone explain this behavior: /* this doesnt work */ mirror=dupwin(window); /* window is a subwin */ getmaxyx(window,y,x); copywin(window,0,0,0,0,y,x,FALSE); /* <--copywin will return ERR */ /* this does work, same as above but... */ copywin(window,0,0,0,0,y-1,x-1,FALSE)
The parameters to copywin() are the window coordinates for the upper left and lower right corners of the rectangle. The return values from getmaxyx(), on the other hand, are the size of the window. (Or to quote X/Open: "The getmaxyx() macro stores the number of rows of the specified window in y and stores the window's number of columns in x.")
So, a 50x20 window would give y = 20, x = 50 from getmaxyx(), but (since the coordinates start at 0, 0) the lower right corner, for copywin(), would be 19, 49.
-- William McBrine <address@hidden>
[Prev in Thread] | Current Thread | [Next in Thread] |