[comp.sys.sgi] something I noticed the other day

trohling@uceng.UC.EDU (tom rohling) (06/14/90)

Here's a little quirk I wonder if anyone can explain:

   I've been writing a small graphics program, say, prog1.c.  This program
   opens a graphics window and draws a few things, nothing much.  When I
   want to kill it, I just go up to the top of the window and select the menu
   item that says "Quit prog1".  This is the menu that all the windows 
   provide to pop, push, stow, etc., so its not something I put there my self.
   Now, the next day I change the name of the program to say, prog2.c.  Same
   program, just a new name.  I recompile everything and run it again.  Now
   if I run the program again and want to kill it in the same way as before,
   the menu item still says "Quit prog1".  ** It doesn't show the new name of
   the program **.  So, I figure, well I'll just wait until tomorrow, maybe its
   cause I'm doing this all in the same day.  Nope.  Still does it a week 
   later! 
   This is not causing any problems or anything, I don't care what it says
   when I go to kill the window, I'm just curious where it gets the old
   file name from all the time, even long after its been changed.

Just wondering,

Tom Rohling
trohling@uceng.uc.edu

blbates@AERO4.LARC.NASA.GOV ("Brent L. Bates AAD/TAB MS361 x42854") (06/15/90)

   You changed the name of the file, but did you change the source to reflect
the file name change.  What is the name in the winopen call?  Do you have a
name other than main?
--

	Brent L. Bates
	NASA-Langley Research Center
	M.S. 361
	Hampton, Virginia  23665-5225
	(804) 864-2854
	E-mail: blbates@aero4.larc.nasa.gov or blbates@aero2.larc.nasa.gov

msc@ramoth.esd.sgi.com (Mark Callow) (06/15/90)

In article <5159@uceng.UC.EDU>, trohling@uceng.UC.EDU (tom rohling) writes:
|> Here's a little quirk I wonder if anyone can explain:
|> 
|>    Now, the next day I change the name of the program to say, prog2.c.  Same
|>    program, just a new name.  I recompile everything and run it again.  Now
|>    if I run the program again and want to kill it in the same way as before,
|>    the menu item still says "Quit prog1".  ** It doesn't show the new
name of

I bet your prog1 contained the line

	winopen("prog1");

and your prog2 contains the same line

	winopen("prog1");

The name used in the menu comes from the argument to the winopen command.
--
From the TARDIS of Mark Callow
msc@ramoth.sgi.com, ...{ames,decwrl}!sgi!msc
"There is much virtue in a window.  It is to a human being as a frame is to
a painting, as a proscenium to a play.  It strongly defines its content."

gavin@krypton.sgi.com (Gavin A. Bell) (06/15/90)

Tom Rohling asks about the name after the 'Quit' in the window border
popup menu:

>   This is not causing any problems or anything, I don't care what it says
>   when I go to kill the window, I'm just curious where it gets the old
>   file name from all the time, even long after its been changed.

>Just wondering,

>Tom Rohling
>trohling@uceng.uc.edu

The name comes from whatever string you pass to the winopen() (Or WINOPE,
if you are a Fortran dude) call.  You probably want to do something
like:

/* Open with the executable's name (stripped of directory) */
{
	char *t, *strrchr(char *, int);
	winopen((t=strrchr(argv[0], '/')) != NULL ? t+1 : argv[0]);
}

... which will make it do what you expect.

The string passed to winopen() is also used as the title of the window
(if wintitle isn't called to reset it), as the title of the icon, and
as the name to look for in /usr/NeWS/icons or ~/.4sight/icons (see the
winicons manual page for more info).  It is also the string used by
the NeWS makepreference/preforigin functions that decide where to put
a program's window when it is first started up.  At trade shows we
often find it useful to make symbolic links to the same program,
giving each its own position on the screen, to bring up a program at
several different screen locations.
--gavin     (gavin@sgi.com,  (415)335-1024)