Thread View: comp.sys.next.programmer
1 messages
1 total messages
Started by Mike D Marchionna
Mon, 13 Apr 1992 20:28
Manipulating any window with an NeXTstep application
Author: Mike D Marchionna
Date: Mon, 13 Apr 1992 20:28
Date: Mon, 13 Apr 1992 20:28
61 lines
3044 bytes
3044 bytes
This may be impossible, but I am trying to write a NeXTstep application that
can tell me the size and location of every window on the screen and let me
reposition them through my NeXTstep application. I am trying to do this
with the DPS operators using the context of the NXApp object. I know it is
possible to write straight postscript code that can manipulate all the windows
on the screen (e.g. the gravity demo within scene, and the icon alignment
utility), but I'm having little luck doing similar things with my App. via
the DPS functions.
For example the IconAlign postscript code uses the screenlistcount and
screenlist operators to get all the window numbers of all the currently
displayed windows. It then uses those window numbers with currentwindowbounds
and movewindow operators. I can get the window list with the
DPSscreenlistcount and DPSscreenlist functions, but when I try to use
the window numbers I get in the window list I always get a range check error.
For example if I wanted to print out a list of all the windows on screen
giving thier location and size I tried to do something like this.
- ListWindows:sender
{ /* Local Variables */
DPSContext context;
int index;
int winCount;
int *winList;
float winX, winY;
float winW, winH;
/* BEGIN ListWindows */
context = [NXApp context];
DPSscreenlistcount(context, 0, &winCount);
winList = (int*)malloc(winCount * sizeof(int));
DPSscreenlist(context, 0, winCount, winList);
for (index = 0; index < winCount; winCount++)
{
DPScurrentwindowbounds(context, winList[index],
&winX, &winY, &winW, winH);
printf("Window:%d (%d,%d) [%d,%d]\n",
winList[index], winX, winY, winW, winH);
}
return(self);
}/* END ListWindow */
This always gives me a range check error and hangs the App at the
DPScurrentwindowbounds call. Strangely I am still able to quit the App.
normally. If I substitute 0 for winList[index] the call works, but
obviously is not what I need. Can anybody explain why this doesn't work, and
maybe suggest an approach that would. I need to repeatedly get the size
and location of all the windows on screen and also to move them from with
my NeXTstep application. Any suggestions or pointers greatly appreciated.
--MDM
--
_________________________________________________________________________
( _______________________________ Brain, and brain! What is brain! )
\________________________________) --Star Trek (Spock's Brain) /
El_Rayo_X_______________________________________________________________/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads