[comp.sys.mac.programmer] FKEYs

neil@dsl.cis.upenn.edu (Neil Radisch) (03/13/88)

Is there any special conditions forced upon an fkey routine that effects
the use of variables?

example
The following works fine
	Procedure fkey;
		begin
		moveto(100,100);
		drawstring('hello');
		end;

The following does nothing
	Procedure fkey;
	var stuff:str255;
		begin
		stuff:='hello';
		moveto(100,100);
		drawstring(stuff);
		end;

Any ideas....Oh by the way I'm using Turbo Pascal



|----------------------------------------------------------------------------|
| "Better to remain quiet and be thought a fool than to speak out and remove |
|  all doubt" --- Abraham Lincoln                                            |
|                                                                            |
|  neil@dsl.cis.upenn.edu.UUCP                                               |
|----------------------------------------------------------------------------|

g099508030ea@deneb.ucdavis.edu (Jim Deline) (03/15/88)

In article <3661@super.upenn.edu> neil@dsl.cis.upenn.edu.UUCP (Neil Radisch) writes:
>Is there any special conditions forced upon an fkey routine that effects
>the use of variables?
>
>example
>The following works fine
>	Procedure fkey;
>		begin
>		moveto(100,100);
>		drawstring('hello');
>		end;
>
>The following does nothing
>	Procedure fkey;
>	var stuff:str255;
>		begin
>		stuff:='hello';
>		moveto(100,100);
>		drawstring(stuff);
>		end;
>
>Any ideas....Oh by the way I'm using Turbo Pascal

Your problem is, Neil, that you are not allowed to declare global
variables in Fkeys.  I know that your Fkey "procedure" looks like
it declares a local variable, but since it is the 'Main' procedure
the compiler treats it like a global declaration.

What you can do is declare your Fkey main procedure, then call a 
procedure outside of main. Other procedures can have local variables.
For instance:

Procedure WriteSomething;
VAR
	aString: Str255;
Begin
	aString := 'Hello';
	moveto(100,100);
	drawstring(aString)
End;

Procedure Fkey;
{ No variables allowed }
Begin
	WriteSomething;
End.

I am not real familiar with Turbo, but in LightSpeed Fkeys are 
declared in units, and there has to be a 'Main' procedure.
I hope this helps.

Jim Deline, UCD Chem Dept.

sho@gibbs.physics.purdue.edu (Sho Kuwamoto) (05/16/91)

It seems like FKEYs have been a little left out recently.  You can't
put them in suitcases, you can't (I think....) drag them into the
system folder.  Now, from IM VI, we have the following:

  FKEY 3 now produces a screenshot, [...] FKEY resource IDs 0 through 2
  and 4 through 9 are reserved for future use by Apple.

Do you get the feeling they don't especially like FKEYs?

-Sho
-- 
sho@physics.purdue.edu

jmatthews@desire.wright.edu (05/16/91)

In article <5108@dirac.physics.purdue.edu>, sho@gibbs.physics.purdue.edu (Sho Kuwamoto) writes:
> It seems like FKEYs have been a little left out recently.  You can't
> put them in suitcases, you can't (I think....) drag them into the
> system folder.  Now, from IM VI, we have the following:
> 
>   FKEY 3 now produces a screenshot, [...] FKEY resource IDs 0 through 2
>   and 4 through 9 are reserved for future use by Apple.
> 
> Do you get the feeling they don't especially like FKEYs?
> 
> -Sho
> -- 
> sho@physics.purdue.edu

I put a few treasured FKEYs in system 7.0b4 and they worked fine. I can't
honestly recall if I dragged them into the system folder or used ResEdit?!
I hadn't noticed the reservation clause in IM6. I guess if Apple fills up the
slots with things I like better, I'll have to do something innovative with
QuicKeys 2 (or whatever). FKEYs forever!

John
o----------------------------------------------------------------------------o
| John B. Matthews, jmatthews@desire.wright.edu, am103@cleveland.freenet.edu |
| "Now why would Dan Rather be standing around on MY porch with a TV crew?"  |
o----------------------------------------------------------------------------o