Alaska Software Inc. - Bug concerning SET FUNCTION TO ...
Username: Password:
AuthorTopic: Bug concerning SET FUNCTION TO ...
Klemens LichterBug concerning SET FUNCTION TO ...
on Thu, 13 Nov 2008 11:23:41 +0100
Just startet to convert another old Clipper application and after adding 
some PRG files to the project in VX, I found a function named "TO" in the 
project manager. I did not remember to have a function with this name inside 
of my old code so I clicked on it to see what it is and found a line with 
the following code:

set FUNCTION 2 TO chr(23)

OK, I remembered that SET FUNCTION is not a valid commad and found in the 
DOCs the way to emulate this command.

So I added the code shown in the DOCs into my project:

#command SET FUNCTION <nFKey> [TO] [<cString>] ;
      => __SETFUNCTION( <nFKey>, #<cString> )

I added into MYPROC.CH and

FUNCTION __SETFUNCTION( nFKey, cString )

IF GetEnableEvents()
   DO CASE
      CASE nFKey <= 10
         nFKey := nFKey + xbeK_F1 - 1
      CASE nFKey <= 20
         nFKey := nFKey + xbeK_CTRL_F1 - 11
      CASE nFKey <= 30
         nFKey := nFKey + xbeK_ALT_F1 - 21
      CASE nFKey <= 40
         nFKey := nFKey + xbeK_SH_F1 - 31
   ENDCASE
   IF Len( cString) == 0
      RETURN SetAppEvent( nFKey, NIL)
   ENDIF
   RETURN SetAppEvent( nFKey, {|| _Keyboard( cString ) } )
 ELSE
   nFKey := IIf( nFKey == 1, 28, 1 - nFKey )
   IF Len( cString) == 0
     RETURN SetKey( nFKey, NIL)
   ENDIF
   RETURN SetKey( nFKey,{|| _Keyboard( cString)})
ENDIF

RETURN NIL

I added into a source code file of the project.
After this I expected this Function TO to disappear from the project manager 
but nothing, it is still there. OK, I hope this will not make errors while 
compiling (I just cant really test because there are some things to do with 
the code before) but it is a little bit confusing...

Klemens
Joe Carrick Re: Bug concerning SET FUNCTION TO ...
on Wed, 12 Nov 2008 06:52:29 -0800
Hi Klemens,

You will probably need to rebuild your VX Project file after making the 
changes.  Sometimes VX doesn't automatically fix this type of problem.

Also, the fact that the function is listed in the project manager 
doesn't mean that it's actually called anyplace in the application.  Use 
the VX Search to find "to(".

This will show you all instances of where it exists in the code.  You 
can then deal with those items appropriately

-Joe

Klemens Lichter wrote:
> Just startet to convert another old Clipper application and after adding 
> some PRG files to the project in VX, I found a function named "TO" in the 
> project manager. I did not remember to have a function with this name inside 
> of my old code so I clicked on it to see what it is and found a line with 
> the following code:
>
> set FUNCTION 2 TO chr(23)
>
> OK, I remembered that SET FUNCTION is not a valid commad and found in the 
> DOCs the way to emulate this command.
>
> So I added the code shown in the DOCs into my project:
>
> #command SET FUNCTION <nFKey> [TO] [<cString>] ;
>       => __SETFUNCTION( <nFKey>, #<cString> )
>
> I added into MYPROC.CH and
>
> FUNCTION __SETFUNCTION( nFKey, cString )
>
> IF GetEnableEvents()
>    DO CASE
>       CASE nFKey <= 10
>          nFKey := nFKey + xbeK_F1 - 1
>       CASE nFKey <= 20
>          nFKey := nFKey + xbeK_CTRL_F1 - 11
>       CASE nFKey <= 30
>          nFKey := nFKey + xbeK_ALT_F1 - 21
>       CASE nFKey <= 40
>          nFKey := nFKey + xbeK_SH_F1 - 31
>    ENDCASE
>    IF Len( cString) == 0
>       RETURN SetAppEvent( nFKey, NIL)
>    ENDIF
>    RETURN SetAppEvent( nFKey, {|| _Keyboard( cString ) } )
>  ELSE
>    nFKey := IIf( nFKey == 1, 28, 1 - nFKey )
>    IF Len( cString) == 0
>      RETURN SetKey( nFKey, NIL)
>    ENDIF
>    RETURN SetKey( nFKey,{|| _Keyboard( cString)})
> ENDIF
>
> RETURN NIL
>
> I added into a source code file of the project.
> After this I expected this Function TO to disappear from the project manager 
> but nothing, it is still there. OK, I hope this will not make errors while 
> compiling (I just cant really test because there are some things to do with 
> the code before) but it is a little bit confusing...
>
> Klemens
>
>
>
Klemens LichterRe: Bug concerning SET FUNCTION TO ...
on Thu, 13 Nov 2008 17:56:10 +0100
Joe,
I did not mention that I rebuilded the XPJ file allready. Also I searched
for a function like this and did not find any. And: If I click at the
function TO in the project manager it goes directly to the line with the SET
FUNCTION TO ... code.

Klemens

NEU: Der Online-Shop www.csl.liefert-es.com mit über 40.000 Artikeln. Büro,
Schule, EDV, Tinte, Toner und Vieles mehr. Einfach ausprobieren!
"Joe Carrick" <joe.carrick@dslextreme.com> schrieb im Newsbeitrag
news:5a9cbb47$323aeb55$9b8@news.alaska-software.com...
> Hi Klemens,
>
> You will probably need to rebuild your VX Project file after making the
> changes.  Sometimes VX doesn't automatically fix this type of problem.
>
> Also, the fact that the function is listed in the project manager
> doesn't mean that it's actually called anyplace in the application.  Use
> the VX Search to find "to(".
>
> This will show you all instances of where it exists in the code.  You
> can then deal with those items appropriately
>
> -Joe
>
> Klemens Lichter wrote:
> > Just startet to convert another old Clipper application and after adding
> > some PRG files to the project in VX, I found a function named "TO" in
the
> > project manager. I did not remember to have a function with this name
inside
> > of my old code so I clicked on it to see what it is and found a line
with
> > the following code:
> >
> > set FUNCTION 2 TO chr(23)
> >
> > OK, I remembered that SET FUNCTION is not a valid commad and found in
the
> > DOCs the way to emulate this command.
> >
> > So I added the code shown in the DOCs into my project:
> >
> > #command SET FUNCTION <nFKey> [TO] [<cString>] ;
> >       => __SETFUNCTION( <nFKey>, #<cString> )
> >
> > I added into MYPROC.CH and
> >
> > FUNCTION __SETFUNCTION( nFKey, cString )
> >
> > IF GetEnableEvents()
> >    DO CASE
> >       CASE nFKey <= 10
> >          nFKey := nFKey + xbeK_F1 - 1
> >       CASE nFKey <= 20
> >          nFKey := nFKey + xbeK_CTRL_F1 - 11
> >       CASE nFKey <= 30
> >          nFKey := nFKey + xbeK_ALT_F1 - 21
> >       CASE nFKey <= 40
> >          nFKey := nFKey + xbeK_SH_F1 - 31
> >    ENDCASE
> >    IF Len( cString) == 0
> >       RETURN SetAppEvent( nFKey, NIL)
> >    ENDIF
> >    RETURN SetAppEvent( nFKey, {|| _Keyboard( cString ) } )
> >  ELSE
> >    nFKey := IIf( nFKey == 1, 28, 1 - nFKey )
> >    IF Len( cString) == 0
> >      RETURN SetKey( nFKey, NIL)
> >    ENDIF
> >    RETURN SetKey( nFKey,{|| _Keyboard( cString)})
> > ENDIF
> >
> > RETURN NIL
> >
> > I added into a source code file of the project.
> > After this I expected this Function TO to disappear from the project
manager
> > but nothing, it is still there. OK, I hope this will not make errors
while
> > compiling (I just cant really test because there are some things to do
with
> > the code before) but it is a little bit confusing...
> >
> > Klemens
> >
> >
> >
Joe Carrick Re: Bug concerning SET FUNCTION TO ...
on Thu, 13 Nov 2008 09:04:02 -0800
Klemens Lichter wrote:
> Joe,
> I did not mention that I rebuilded the XPJ file allready. Also I searched
> for a function like this and did not find any. And: If I click at the
> function TO in the project manager it goes directly to the line with the SET
> FUNCTION TO ... code.
> 
> Klemens
> 
You should delete that line - or better yet, comment it out.

-Joe