mlab2@kuhub.cc.ukans.edu (12/31/90)
How do you access 'globals' from Pascal? Example: Changing the volume of the Mac. Example: Setting the height of the menu bar to 0. I know, don't touch these, but I write games. Need I say more? (Bane of the Human Interface Guidelines :) ). Has this been beaten like a dog already? Thanks in advance. (BTW, still can't respond to mail) :======:**************************************************************** : ==== :* john calhoun ** And watching the stars go on at night, ** : === :* Soft Dorothy ** I'd like to see just one of them die.. ** :.=....:****************************************************************
phils@chaos.cs.brandeis.edu (Phil Shapiro) (01/01/91)
In article <27660.277e4ce1@kuhub.cc.ukans.edu> mlab2@kuhub.cc.ukans.edu writes:
How do you access 'globals' from Pascal? Example: Changing the
volume of the Mac. Example: Setting the height of the menu bar to 0.
Kind of clumsy compared with C:
program foo;
const
MBarHeight = $BAA; { contains integer height of menu bar }
type
IntPtr = ^Integer; { need this to coerce our constant into a pointer }
begin
writeln('The current menu bar height is ',IntPtr(MBarHeight)^);
IntPtr(MBarHeight)^ := 40; { change it to 40 pixels }
end.
Note that really removing the menu bar involves changing the GrayRgn.
Check out the UMPG, there's an example in there.
-phil
--
Phil Shapiro Technical Support Analyst
Language Products Group Symantec Corporation
Internet: phils@chaos.cs.brandeis.edu
--
Phil Shapiro Technical Support Analyst
Language Products Group Symantec CorporationChris.Gehlker@p12.f56.n114.z1.fidonet.org (Chris Gehlker) (01/03/91)
M> How do you access 'globals' from Pascal? Example: Changing the
M> volume of the Mac. Example: Setting the height of the menu bar
M> to 0. I know, don't touch these, but I write games. Need I say
M> more? (Bane of the Human Interface Guidelines :) ). Has this
M> been beaten like a dog already?
You can set the sound volume with SetSoundVol and avoid globals alltoghther.
As for the menu bar height, the following code doesn't work but it does
illustrate
setting globals:
program MBarHeight;
uses
Script;
type
WordPtr = ^integer;
var
OldHeight: integer;
theMBarHeight: WordPtr;
begin
OldHeight := GetMBarHeight;
theMBarHeight := WordPtr($BAA);
theMBarHeight^ := 0;
DrawMenuBar;
repeat
until Button;
theMBarHeight^ := OldHeight;
DrawMenuBar
end.
Setting the global here doesn't really change the way DrawMenuBar works.
You'll have to convince the Menu Manager that the System Font is zero pixels
high or just draw over the menu bar.
--
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!56.12!Chris.Gehlker
Internet: Chris.Gehlker@p12.f56.n114.z1.fidonet.org