Explain setpath() in tastrade main.prg 
Author Message
 Explain setpath() in tastrade main.prg

The following function come from main.prg in the tastrade application.
It looks to me like a useful function for setting the application's
initial path but there is a line that I cannot understand:

FUNCTION SetPath()
  LOCAL lcSys16, ;
        lcProgram

  lcSys16 = SYS(16)
  lcProgram = SUBSTR(lcSys16, AT(":", lcSys16) - 1)

  CD LEFT(lcProgram, RAT("\", lcProgram))
  *-- If we are running MAIN.PRG directly, then
  *-- CD up to the parent directory
  IF RIGHT(lcProgram, 3) = "FXP"
    CD ..
  ENDIF
  SET PATH TO PROGS, FORMS, LIBS, ;
        MENUS, DATA, OTHER, ;
        REPORTS, INCLUDE, HELP, ;
        BITMAPS
  SET CLASSLIB TO MAIN, TSGEN
ENDFUNC

can anyone explain what line 4:

lcProgram = SUBSTR(lcSys16, AT(":", lcSys16) - 1)

does?

As far as I can see it just seems to return the full value of sys(16). I
cannot see the point of it. Any help would be appreciated.
--
Vic Forte



Mon, 02 Jul 2001 03:00:00 GMT  
 Explain setpath() in tastrade main.prg
It returns the extension of the executive program (probably either PRG, EXE,
or APP).  It seems to include a little bit of extra info too, since it
starts 1 character before the period.  Dunno why it does that!

Eric


Quote:
>The following function come from main.prg in the tastrade application.
>It looks to me like a useful function for setting the application's
>initial path but there is a line that I cannot understand:

>FUNCTION SetPath()
>  LOCAL lcSys16, ;
>        lcProgram

>  lcSys16 = SYS(16)
>  lcProgram = SUBSTR(lcSys16, AT(":", lcSys16) - 1)

>  CD LEFT(lcProgram, RAT("\", lcProgram))
>  *-- If we are running MAIN.PRG directly, then
>  *-- CD up to the parent directory
>  IF RIGHT(lcProgram, 3) = "FXP"
>    CD ..
>  ENDIF
>  SET PATH TO PROGS, FORMS, LIBS, ;
>        MENUS, DATA, OTHER, ;
>        REPORTS, INCLUDE, HELP, ;
>        BITMAPS
>  SET CLASSLIB TO MAIN, TSGEN
>ENDFUNC

>can anyone explain what line 4:

>lcProgram = SUBSTR(lcSys16, AT(":", lcSys16) - 1)

>does?

>As far as I can see it just seems to return the full value of sys(16). I
>cannot see the point of it. Any help would be appreciated.
>--
>Vic Forte



Mon, 02 Jul 2001 03:00:00 GMT  
 Explain setpath() in tastrade main.prg

Quote:
> can anyone explain what line 4:

> lcProgram = SUBSTR(lcSys16, AT(":", lcSys16) - 1)

> does?

> As far as I can see it just seems to return the full value of sys(16). I
> cannot see the point of it. Any help would be appreciated.

It does nothing that I can see, either.  Perhaps, in some situations, there
is something before the "C" below:

lcSys16="?C:\Program.prg"



Mon, 02 Jul 2001 03:00:00 GMT  
 Explain setpath() in tastrade main.prg


Quote:

>It does nothing that I can see, either.  Perhaps, in some situations, there
>is something before the "C" below:

>lcSys16="?C:\Program.prg"

That's comforting. At least I'm not as stupid as I look :)

Best wishes.
--
Vic Forte



Tue, 03 Jul 2001 03:00:00 GMT  
 Explain setpath() in tastrade main.prg

Quote:
>>It does nothing that I can see, either.  Perhaps, in some situations,
there
>>is something before the "C" below:

>>lcSys16="?C:\Program.prg"

In some situations, there is no : at all, I suppose; I just wrote a program
that just did a

? SYS(16), and called it like this:

do \\bremen\chords\temp\x.prg

... and sure enough the result was \\BREMEN\CHORDS\TEMP\X.FXP.

So, what you're saying here, is that you found a bug in Tastrade.

And THIS is NEWS <gd&r>?

Quote:
>L<



Wed, 04 Jul 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Referencing a form control from the main.prg

2. #DEFINE varname only shows up in MAIN.PRG

3. main.prg problem

4. Executing a PRG from a PRG

5. Big PRG or Small PRG?

6. making forms to be main screen instead of reside in vfp main window

7. How can I run Tastrade in VFP6

8. How good is Tastrade?

9. Who has experience with the Tastrade App?

10. Tastrade CursorSetProp

11. What instanciates the toolbar on TasTrade forms?

12. Who can help on VFP TASTRADE

 

 
Powered by phpBB® Forum Software