#DEFINE varname only shows up in MAIN.PRG 
Author Message
 #DEFINE varname only shows up in MAIN.PRG

I'm trying to get my application to recognize my INCLUDE files all throughout.
It's as if only the main.prg recognizes the #DEFINE statements.  Any ideas
here?

Mike



Sat, 04 Aug 2001 03:00:00 GMT  
 #DEFINE varname only shows up in MAIN.PRG
Mike, I think that's by design unfortunately ...

Quote:
>It's as if only the main.prg recognizes the #DEFINE statements.  Any >

ideas here?


Sat, 04 Aug 2001 03:00:00 GMT  
 #DEFINE varname only shows up in MAIN.PRG
It can't be by design because the TASTRADE program does not have this problem.

Are you saying I have to do an

#INCLUDE "foxpro.h"

in every one of my procedures.  For example,
procedure main does the following:

oApp = createobject("app")
oApp.start()

Now I have to put the #INCLUDE "foxpro.h" in the start() method and every
single method in my program?  That just can't be.
Mike



Sun, 05 Aug 2001 03:00:00 GMT  
 #DEFINE varname only shows up in MAIN.PRG
Sorry, I thought you were using FPD/FPW. According to the VFP online help,
#DEFINEs are only in effect in the program that creates them. Maybe if you
have your #DEFINEs in a .h file, then #INCLUDE the .h file in whatever
program/form in your project that's tagged as the 'main' that might work.
Although if you look at the forms in Tastrade, they all have the TASTRADE.H
header file set in the Form\Include File menu option.
I wouldn't try to use these features like you would in C - they're just not
as powerful (probably because C is compiled and VFP isn't really.)


Sun, 05 Aug 2001 03:00:00 GMT  
 #DEFINE varname only shows up in MAIN.PRG
Okay,

I saw that the include file was in the form include.  Now, I understand that
and I also saw where they included it in the class files.

New question, in the INIT() in the Tasmanian class, they have the following:

llRetVal = Application::Init()

Now, what I don't understand is how they are able to call the init() procedure
from the application class which is in the tsgen library.

when I try to call a method in a different class library I get the following
error:

the current object does not inherit from the class test1

I can't figure this out.  I have done a
SET CLASSLIB TO mylib
where the class test1 is defined in mylib. This is the line of code that gives
the error:

test1::init()

Any ideas on this one?

Mike



Mon, 06 Aug 2001 03:00:00 GMT  
 #DEFINE varname only shows up in MAIN.PRG
In your opinion what is the ideal way to include the .h files?  Would you use
the form include like in Tasmanian or would you just put them in the init
method in the class.  In fact, if you put them in the init method in the class
I'm not even sure if they will work in other methods in the class (that's one
I'll have to test).

Also, what's the best way to two or three command buttons?  When I put them in
a container and center the container, only the container gets centered and not
the objects.
Mike



Mon, 06 Aug 2001 03:00:00 GMT  
 #DEFINE varname only shows up in MAIN.PRG

Quote:

>In your opinion what is the ideal way to include the .h files?

You could subclass the Form base class, and incude the file in your new
class (say MyForm). Then base all your project forms on MyForm.

Quote:
>Also, what's the best way to two or three command buttons?  When I put them

in a container and center the container, only the container gets centered
and not the objects.

Why not use a  CommandGroup object?



Mon, 06 Aug 2001 03:00:00 GMT  
 #DEFINE varname only shows up in MAIN.PRG
#DEFINE works only in the program where their created. At compile time,
every "variable" that is #DEFINEd is replaced by the value in the  #DEFINE
definition. In run-time the "variables" are constants as if they were
hard-coded. They cannot be an extra load regarding file size or execution
speed, only compiling could maybe slowed down a bit.

I don't know how these thing work in C, but here they tidy things up and can
make more readable code, and can be effectively gathered in an #INCLUDEd
file

Quote:

>Sorry, I thought you were using FPD/FPW. According to the VFP online help,
>#DEFINEs are only in effect in the program that creates them. Maybe if you
>have your #DEFINEs in a .h file, then #INCLUDE the .h file in whatever
>program/form in your project that's tagged as the 'main' that might work.
>Although if you look at the forms in Tastrade, they all have the TASTRADE.H
>header file set in the Form\Include File menu option.
>I wouldn't try to use these features like you would in C - they're just not
>as powerful (probably because C is compiled and VFP isn't really.)



Mon, 06 Aug 2001 03:00:00 GMT  
 #DEFINE varname only shows up in MAIN.PRG
I could use the commandgroup object but then I have to center the buttons in
the command group.  Also, I can't subclass it.  If I do then it only centers
the container and not the buttons.  I just can't believe it's this complicated
to simply center two buttons on the screen.
Mike


Mon, 06 Aug 2001 03:00:00 GMT  
 #DEFINE varname only shows up in MAIN.PRG
Well, the error message is pretty accurate. The scope resolution operator
(::) can only be used to call methods of classes from which the object/class
being used inherits.

--
Jeremy Fujimoto-Johnson

Quote:

>Okay,

>I saw that the include file was in the form include.  Now, I understand
that
>and I also saw where they included it in the class files.

>New question, in the INIT() in the Tasmanian class, they have the
following:

>llRetVal = Application::Init()

>Now, what I don't understand is how they are able to call the init()
procedure
>from the application class which is in the tsgen library.

>when I try to call a method in a different class library I get the
following
>error:

>the current object does not inherit from the class test1

>I can't figure this out.  I have done a
>SET CLASSLIB TO mylib
>where the class test1 is defined in mylib. This is the line of code that
gives
>the error:

>test1::init()

>Any ideas on this one?

>Mike



Wed, 08 Aug 2001 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Referencing a form control from the main.prg

2. main.prg problem

3. Defining SubClasses in PRG's

4. PRG defined modal form won't release ???

5. Explain setpath() in tastrade main.prg

6. Hiding and showing main screen

7. Starting an application without showing the main VFP window

8. Do <varname>

9. DO FORM frmForm1 TO VarName not wotking with arrays

10. how to show a menu on a main form with the Visual FoxPro main window hidden?

11. how to show a menu on a main form with the Visual FoxPro main window hidden?

12. Executing a PRG from a PRG

 

 
Powered by phpBB® Forum Software