All I want to do is run a few lines of code at startup and I'm getting all
kinds of grief from VFP8.
I'm writing an app (HouseCallCID is the app) and I want it to creat a few
public objects, set some public variables, etc.
I'm using the VFP8 app wizard to create the folders, etc. It creates a
main app called housecallcid_app which does some stuff I can't seem to wrap
my brain around without reading tons of pre-generated source code.
Here's the question:
Where can I run my startup() procedure that sets up all my variables, etc.
When I get it to work by putting it in the init() of the application
object, I get "goapp is not an object" when I shut down.
I get various errors when I try to put it in the housecallcid_app program
depending on where I put it.
This shouldn't be this hard. The one thing that MS sorely fails in is
documenting their included objects, etc. (especially the framework it
comes with).
Is there a site somewhere that can give me a better understanding than
msdn.microsoft.com (sux 4 framework)?
--Mike Shull
Dummy Newgroup name - 18 Apr 2005 12:15 GMT
In fact "MS 'framework' sux".
The great thing about frameworks is that they do a lot for you. The
not so great other side of the coin is that you need to learn
something else, ie how they work.
If you're getting "goApp is not an object" you've inserted your call
before it's being created. One of the things to knowing where things
happen is that you've got to put in a lot of "DoDefault", certainly
into the app init, and (usually) put your own code afterwards.
I'm sorry, I gave up using the (MS) app builder too long ago to be
able to remember what's where, have a poke around to find out where
it's happening. Not very helpful I know 8-(
Regards
Mark
Mike Pratt - 18 Apr 2005 17:30 GMT
Hi Mike,
Any variable created in the init that aren't declared public are
destroyed when the init finishes. Create goapp in the main.prg that
loads the main form.
Regards,
Mike
>All I want to do is run a few lines of code at startup and I'm getting all
>kinds of grief from VFP8.
[quoted text clipped - 24 lines]
>
>--Mike Shull
Mike Shull - 20 Apr 2005 09:29 GMT
Actually, I left the main prg as the one the wizard created. The goapp
object is created there, and my code is definitely after the createobject
() command. Depending on where I put it, it either never runs or causes
errors. I'm thinking of abandoning the app wizard as a convoluted bit of
code whose only purpose is to complicate things and slow down the app
(runtime and development time).
--Mike
> Hi Mike,
>
[quoted text clipped - 36 lines]
>>
>>--Mike Shull
Mike Pratt - 20 Apr 2005 17:06 GMT
Hi Mike,
I feel your pain. In my lurking here I have learned: never use wizards
or formsets, and the framework is a learning tool. I've used it too,
an all you have to do is change 1 or 2 little properties ant the app
breaks.
Try this:
In the Program Manager Code tab under Programs should be a main. If
you don't have a Program manager showing click on new and select the
button that doesn't show a wizard.
In Program->main (New if it's not there) add two lines:
DO FORM myForm
READ EVENTS
Close and save it as main. If it's not in bold right click on it as
choose Set as Main.
Create a form (not with the wiz) and add a command button with
thisform.release() in its click event. Add CLEAR EVENTS in it's
destroy event.Set it's ShowWindow property as = 2 (As Top Level Form)
Save it as myForm.
Go back to the program and highlight main and choose the run button.
Regards,
Mike
>Actually, I left the main prg as the one the wizard created. The goapp
>object is created there, and my code is definitely after the createobject
[quoted text clipped - 45 lines]
>>>
>>>--Mike Shull
Dummy Newgroup name - 20 Apr 2005 21:19 GMT
The framework (in general, not the MicroSoft rubbish one) is a very
useful and powerful tool.
However, it doesn't come without cost, and that cost is one that many
people don't wish to pay. It doesn't make a framework a bad idea
though.
Mark
Mike Pratt - 21 Apr 2005 15:56 GMT
Hi Mark,
I agree about Frameworks, but the Framework supplied with VFP was a
learning tool that was never meant to be used for production apps. The
one I have most recently used is Codebook. For more info go to
http://www.leafe.com , Codebook itself is available at
sourceforge.net.
Regards,
Mike
>The framework (in general, not the MicroSoft rubbish one) is a very
>useful and powerful tool.
[quoted text clipped - 4 lines]
>
>Mark
Cindy Winegarden - 19 Apr 2005 02:03 GMT
Hi Mike,
The VFP wizard framework is probably overkill for what you're trying to do.
For an example of a simple app have a look at the one you can download from
TakeNote Technologies (www.takenote.com, create a registration for yourself
and go to the downloads section).
Any objects or variables you create in your Main program will be visible to
the rest of the app.

Signature
Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP
cindy_winegarden@msn.com www.cindywinegarden.com
Blog: http://spaces.msn.com/members/cindywinegarden
> All I want to do is run a few lines of code at startup and I'm getting all
> kinds of grief from VFP8.....