#Windows
7 messages in this thread
Does anyone know how to make a window inactive without having to close
and re-open it? I want to inactivate a window after using it, but don't like
the idea of closing and re-opening. Thanks, Mike.
Michael,
One method would be to use ActivateWindow() on another window. Why (and in
what circumstances) do you want to de-activate a window? —Mike
You can find a pointer (BPTR) to the CLI window in the process structure of
your program, if it was started from the CLI. You could activate that
window and since only one window can be active, yours would be
de-activated. If your window wasn't created from the CLI you might be able
to cruise through the linked list of screens and look for opened windows. I
think the workbench always has an opened window.
Robert,
I would almost have to activate the workbench window, since any
checking for the active window implies that my window has been activated!
Thanks for the tip on the process structure, I'm just beginning to get my feet
wet in Intuition and Exec etc…
Mike Cook
Robert:
Be careful with this, I don't think that's right. As I recall, what
appears to be the window ptr to the CLI window in the process structure is
actually where YOU'RE supposed to put a pointer to the window where error
requesters can pop up. To get the pointer to the CLI window requires sending a
DOS Packet to the particular filesystem(?) task for that CLI, and reading the
pointer out of the reply.
It's been awhile since I looked at this, but I'm reasonably sure it's
true.
Ariel
First, you don't have to activate the window to use it – you can do any window
operation while it's not active.
Assuming you still want to do this, well, what window do you want to become
active? You could always pick the biggest window on the screen you're
currently working on and ActivateWindow() it, or something similar, but if
there isn't a particular window you need to activate, it might be less
confusing for the user if you just leave yours active.
…Steve
Steve,
I want (ideally) to re-activate the window the user was in before
selecting the string gadget in my window. Selecting the gadget will activate my
window, although the gadget is the only input source for the window. A
suggestion was to walk the window list to find the active window (from the
screen structure) but after thinking about it, by the time my program executes,
my window is the active one! Right? If I try to save the active window pointer
when my program first starts, I have to assume that it will be sticking around
for awhile, not a good assumption. I may be better off letting the user select
the window with the mouse.
Mike Cook