[comp.sys.amiga] Anybody know how to do this stuff?

koren%hpfelg.hp.com@cunyvm.cuny.edu (12/15/89)

> Do you have a counterexample?  It sounds a lot like you are setting
> titles for windows you do not own and then exiting, or otherwise
> treading dangerously on thin ice.

Well, this point is a little unclear to me.  Who "owns" the CLI window?
Is the the currently running shell?  What if a shell is invoked from
within a shell?  I wished to add a command which lets the user change
the window title bar of the CLI window by saying something like:

     window -title "my title"

I wanted to implement this command as an external binary.  The binary
sets the window title and then exits.  Perhaps that is not a legal thing
to do, in which case I'll leave the command out.

It is probably a bit late for this now, but it is my belief (just opinion
here) that a child procedure should not depend on dynamically allocated data
passed to it hanging around after the child exits.  If it needs the data,
it should copy it.  Having it depend on the data's persistance increases
coupling strength between the two procedures, which is generally regarded
as a "bad thing" in software engineering circles.  (Of course, I do this
sometimes myself :-)

Anyhow, thanks for the help.

    - steve

andy@cbmvax.commodore.com (Andy Finkel) (12/15/89)

In article <6149@nigel.udel.EDU> koren%hpfelg.hp.com@cunyvm.cuny.edu writes:
>Well, this point is a little unclear to me.  Who "owns" the CLI window?
>Is the the currently running shell?  What if a shell is invoked from

In general, there's a simple way to tell if you own an Intuition
window.  If your program  makes the Intuition OpenWindow call, your
program owns the resulting window.

-- 
andy finkel		{uunet|rutgers|amiga}!cbmvax!andy
Commodore-Amiga, Inc.

"When I was a little boy I wanted to be a fireman.  Now I am."

Any expressed opinions are mine; but feel free to share.
I disclaim all responsibilities, all shapes, all sizes, all colors.

dwl10@uts.amdahl.com (Dave Lowrey) (12/16/89)

In article <6149@nigel.udel.EDU> koren%hpfelg.hp.com@cunyvm.cuny.edu writes:
>
>Well, this point is a little unclear to me.  Who "owns" the CLI window?
>Is the the currently running shell?  What if a shell is invoked from
>within a shell?  I wished to add a command which lets the user change
>the window title bar of the CLI window by saying something like:
>
>     window -title "my title"
>
>I wanted to implement this command as an external binary.  The binary
>sets the window title and then exits.  Perhaps that is not a legal thing
>to do, in which case I'll leave the command out.
>
The window is owned by the process that opened it. You will have problems
with writing your program for that reason. The "owner" of the window is   ata
responsible for refreshing it. Part of the refresh process is to re-write
the title, if necessary. This requires the title text to be avaliable. If
you make a new title, it will stay around until the window is refreshed, t
then the title will be garbage because your program has exited, and the
memory that was taken by the new title has been allocated for something
else!
You could allocate memory for the title, and not free it. But then who
will free it when the window is closed?

I attempted to do this, and found the only way was to have a program
sitting in the background that periodically checked the windows, and
changed titles if necessary. I decided it wasn't worth the extra cycles
and memory.

-- 
"What is another word  |  Dave Lowrey    | [The opinions expressed MAY be
 for 'Thesaurus'?"     |  Amdahl Corp.   | those of the author and are not
                       |  Houston, Texas | necessarily those of his
   Steven Wright       |  amdahl!dwl10   | employer]   (`nuff said!)