bmyers@garnet.berkeley.edu (Brian Myers) (10/06/90)
I want to change the title of the Pascal Drawing window from "Drawing" to something else. I could probably do it by using ShowWindow to bring the window to the front and the calling the function that gives you the handle of the active window, but I want a more versatile algorithm that doesn't require bringing the window to the front. There's an assembly language constant called, I think, WindowsList, or somethinglike that, but THINK Pascal doesn't recognize it, so I can't get at the first entry in the system's linked list of windows. I also can't find any other traps that return a window handle unless you already have some other window handle to pass them. (Unless of course you create brand new windows, which is not what I need to do.) I assume there's some simple solution that I as a mere novice creeping over from the MS-DOS world haven't yet encountered? --------------------------------------------------------------------------- Brian Myers bmyers@garnet.berkeley.edu
murat@farcomp.UUCP (Murat Konar) (10/09/90)
In article <1990Oct6.063726.19882@agate.berkeley.edu> bmyers@garnet.berkeley.edu (Brian Myers) writes: >I want to change the title of the Pascal Drawing window from "Drawing" to >something else. I could probably do it by using ShowWindow to bring >the window to the front and the calling the function that gives you the >handle of the active window, but I want a more versatile algorithm that >doesn't require bringing the window to the front. > >There's an assembly language constant called, I think, WindowsList, or somethinglike that, but THINK Pascal doesn't recognize it, so I can't get at the >first entry in the system's linked list of windows. I also can't findi [ the rest deleted] First of all, windows are referred to by pointers not handles. Don't ask me why. Anyhow, there is a call named FrontWindow that takes no arguments and returns a pointer to the front most window. Since all windows of an application are maintained in a linked list, you can walk down the list until you find the window you want. Hope this helps. -- ____________________________________________________________________ Have a day. :^| Murat N. Konar murat@farcomp.UUCP -or- farcomp!murat@apple.com
smoke@well.sf.ca.us (Nicholas Jackiw) (10/10/90)
In article <1990Oct6.063726.19882@agate.berkeley.edu> bmyers@garnet.berkeley.edu (Brian Myers) writes: >I want to change the title of the Pascal Drawing window from "Drawing" to >something else. > I could probably do it by using ShowWindow to bring >the window to the front and the calling the function that gives you the >handle of the active window, but I want a more versatile algorithm that >doesn't require bringing the window to the front. You couldn't do it that way: Think Pascal patches the function in question (FrontWindow) so that it never returns a Think Pascal window-- only windows your program creates. (By the way, it returns a ptr to windows; windowRecords should never be allocated in a relocatable fashion.) Pascal can't interfere with the window record's linked list of windows, however. So if you bring up a topmost but invisible window, take the ptr to it which NewWindow returns, and look through the list starting at WindowPeek(theWindow)^.nextWindow, you'll eventually find one such that WindowPeek(someWindow)^.titleHandle^^='Drawing'. You can change this title with SetWTitle. >There's an assembly language constant called, I think, WindowsList, or somethinglike that, but THINK Pascal doesn't recognize it, so I can't get at the >first entry in the system's linked list of windows. I also can't find >any other traps that return a window handle unless you already have some >other window handle to pass them. (Unless of course you create brand >new windows, which is not what I need to do.) To access WindowList from Pascal: const WindowList=$9D6; type longPtr:^longint; var aWind:WindowPeek; begin aWind:=WindowPeek(longPtr(WindowList)^); ... >I assume there's some simple solution that I as a mere novice creeping >over from the MS-DOS world haven't yet encountered? > Both of these are rather klunky solutions, and depend on specific implementations of Pascal and low-memory. The difference between the drawing window and one you create yourself is minimal--why not take the plunge? -- --- * --- Nicholas Jackiw Smoke@well.sf.ca.us | Jackiw@cs.swarthmore.edu Key Curriculum Press, Inc. Applelink: D3970 | (415) 548-2304 --- * ---
ech@cbnewsk.att.com (ned.horvath) (10/10/90)
From article <248@farcomp.UUCP>, by murat@farcomp.UUCP (Murat Konar): > In article <1990Oct6.063726.19882@agate.berkeley.edu> bmyers@garnet.berkeley.edu (Brian Myers) writes: >>I want to change the title of the Pascal Drawing window from "Drawing" to >>something else. I could probably do it by using ShowWindow to bring >>the window to the front and the calling the function that gives you the >>handle of the active window, but I want a more versatile algorithm that >>doesn't require bringing the window to the front. > First of all, windows are referred to by pointers not handles. Don't ask me > why. > Anyhow, there is a call named FrontWindow that takes no arguments and returns > a pointer to the front most window. Since all windows of an application are > maintained in a linked list, you can walk down the list until you find the > window you want. The low-memory global is called WindowList, and it's a WindowPeek located at $9D6. From Think Pascal you need something like FUNCTION WindowList : WindowPeek; INLINE $2eb8, $09d6; Mr. Konar's suggestion will work just fine if there is at least one visible window in front of the window you seek. Notice, however, that FrontWindow returns the frontmost VISIBLE window, and hence may even return nil if all the app's windows are currently hidden. Yes, I've been burned by this one... =Ned Horvath=
gurgle@well.sf.ca.us (Pete Gontier) (10/10/90)
In article <21099@well.sf.ca.us> smoke@well.sf.ca.us (Nicholas Jackiw) writes: >In article <1990Oct6.063726.19882@agate.berkeley.edu> bmyers@garnet.berkeley.ed u (Brian Myers) writes: >>I want to change the title of the Pascal Drawing window from "Drawing" to >>something else. >Pascal can't interfere with the window record's linked list of windows, >however. So if you bring up a topmost but invisible window, take the >ptr to it which NewWindow returns, and look through the list starting >at WindowPeek(theWindow)^.nextWindow, you'll eventually find one >such that WindowPeek(someWindow)^.titleHandle^^='Drawing'. You can >change this title with SetWTitle. Have you actually done this? I remembering trying to do it to the text window. Every once in a while, Pascal calls SetWTitle itself, always with the same string. I'd have had to patch SetWTitle. But that was before I discovered the event loop gets murdered when you run with the text window. Bad news. -- Pete Gontier, gurgle@well.sf.ca.us Software Imagineer, Kiwi Software, Inc.