Home > Archive > Programming with dBASE > November 2005 > on key label question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author on key label question
Martin Lambert

2005-11-22, 3:23 am

I want to use the on key label function like this :

ON KEY LABEL F2 form.rowset.save()
and I receive an error message that form is not defined.

I tried also on key label F2 class::bitmapsave1_o
nclick()

I made a test with on key label F2 MSGBOX("test","test,0) and it work.

What am I doing wrong ?


Roland Wingerter

2005-11-22, 7:23 am

Martin Lambert wrote

>I want to use the on key label function like this :
>
> ON KEY LABEL F2 form.rowset.save()
> and I receive an error message that form is not defined.
>
> I tried also on key label F2 class::bitmapsave1_o
nclick()
>
> I made a test with on key label F2 MSGBOX("test","test,0) and it work.
>
> What am I doing wrong ?

-------
See message below by Gary White.

Roland

********************
********************
********************
********
From: "Gary White [dBVIPS]" <dBVIPS@usa.net>
Newsgroups: dbase.programming
Subject: Re: Set Function Key
Date: Tue, 21 Sep 1999 13:26:58 -0500
Message ID: < Y83nN0yDVlMF7hwWqjKX
uNfzf3g4@4ax.com>
ON KEY is a global setting. It will not recognize your form unless
you place a reference to it where it can be found. Try using
onGotFocus and onLostFocus routines in the form:

function onGotFocus
_app.ActiveForm = this
on key label f2 _app.ActiveForm.DoSomething()
return

function onLostFocus
on key label f2
_app.ActiveForm = null
return


Gary White
& #91;dBVIPS]*********
********************
********************
*******************


Todd Kreuter

2005-11-22, 7:23 am

Martin Lambert wrote:
>
> I want to use the on key label function like this :
>
> ON KEY LABEL F2 form.rowset.save()
> and I receive an error message that form is not defined.
>
> I tried also on key label F2 class::bitmapsave1_o
nclick()
>
> I made a test with on key label F2 MSGBOX("test","test,0) and it work.
>
> What am I doing wrong ?


You should also look into using menus and menu short-cuts.

--
Todd Kreuter [dBVIPS]
Richard Perryman

2005-11-22, 9:23 am

Todd Kreuter wrote:
>
> You should also look into using menus and menu short-cuts.
>


Not only that - you can actually assign a key to button and then just
hide the button - just move it off screen and it will still work for
that key stroke.
*Lysander*

2005-11-22, 11:23 am

In article <v9KNHAz7FHA.1996@news-server>, lambertmartin@videot
ron.ca=20
says...

> ON KEY LABEL F2 form.rowset.save()
> and I receive an error message that form is not defined.


In addition to what Roland wrote:
this error occurs because the variable "form" is out of scope in this=20
case. Most likely it has a local scope while ON KEY LABEL needs a public=20
scope.

Keep in mind that ON KEY LABEL is a GLOBAL function, and that it has a=20
pretty good potential of causing a variety of problems.
So... punchline... you better use it only when it's absolutely=20
necessary.


--=20
ciao,
Andr=E9
Martin Lambert

2005-11-23, 7:23 am

Thanks. It works like a charm.

"Roland Wingerter" <ich@hier.de> a écrit dans le message de news:
0Av3vh17FHA.1996@news-server...
> Martin Lambert wrote
> -------
> See message below by Gary White.
>
> Roland
>
> ********************
********************
********************
********
> From: "Gary White [dBVIPS]" <dBVIPS@usa.net>
> Newsgroups: dbase.programming
> Subject: Re: Set Function Key
> Date: Tue, 21 Sep 1999 13:26:58 -0500
> Message ID: < Y83nN0yDVlMF7hwWqjKX
uNfzf3g4@4ax.com>
> ON KEY is a global setting. It will not recognize your form unless
> you place a reference to it where it can be found. Try using
> onGotFocus and onLostFocus routines in the form:
>
> function onGotFocus
> _app.ActiveForm = this
> on key label f2 _app.ActiveForm.DoSomething()
> return
>
> function onLostFocus
> on key label f2
> _app.ActiveForm = null
> return
>
>
> Gary White
> & #91;dBVIPS]*********
********************
********************
*******************
>



Roland Wingerter

2005-11-23, 7:23 am

Martin Lambert wrote

> Thanks. It works like a charm.

-------
FWIW, the old ng search is still available:

http://64.132.211.166/Docs/Search.htm

Roland


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com