Welcome, Guest. Please login or register.

Author Topic: get window list from current screen  (Read 2604 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Thomas

Re: get window list from current screen
« on: December 25, 2004, 11:49:08 PM »

Do LockIBase(), then use IntuitionBase->FirstScreen, Screen->FirstWindow and Window->NextWindow until Window is NULL, then do UnlockIBase(). You must not use any functions inbetween LockIBase() and UnLockIBase() and you have to consider that windows may be closed after UnLockIBase() so you must not use the window pointers.

Bye,
Thomas

Offline Thomas

Re: get window list from current screen
« Reply #1 on: December 30, 2004, 02:03:42 PM »

Well, there are several possibilities to solve this.

One is to prepare an array which is big enough for most cases, for example to hold 100 screens and 1000 windows or something like that. If the limits are reached anyway, you can either inform the user that he is using too much windows or just omit the remaining ones.

The second possbility is to go through the lists twice: first count the number of screens and windows, then allocate the array (using malloc or AllocVec) and finally go through the lists again and fill the array.

And the third solution is to use pointered lists yourself. This is the most dynamic version but it might be quite difficult to access because you don't have an array but have to walk through your own lists, too.

Bye,
Thomas