Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Top Level Form behaviour 1

Status
Not open for further replies.

florindaniel

Programmer
Dec 4, 2009
120
RO
Hello,

I have this simple code (main.prg):
<do some config stuff>
do form MyForm
Read Events
...
quit
function XY
endfunc

MyForm is declared as Top Level Form, since I need only
that form to be on the screen, and I have some buttons
on it.
My problem is I can not use XY func because is seems not
to be accesible from within the form ... ?
What I am doing wrong?

Thank you
Daniel
 
Daniel,

So, you have a top-level form that's trying to call a function that's defined in the PRG that launches the form.

I can't see anything intrinsically wrong with that. Are you sure you haven't got a syntax error in the calling code?

Perhaps you could post the code that calls the function, and also tell us what error (if any) you are seeing.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
I agree with Mike, I can not see anything wrong based on what you've posted.

Alan
 
Hello Mike, Hello Alan

Thx for help.

After gaining some self trust by reading your answers, I've printed my current procedure, restored a previous version of the form (and lost some work) and the I wrote the code again... and it worked this time. It seems there was some problem with the SCX file, since it happend some other time to have a commandbutton dissapear in a form.

I've never worked with top level forms and I thought there might be a problem there. I still have some problems with the environnement settings that seem not to be tha same with the ones I set into the main program, but I'll keep trying.

Thank you again,
Daniel
 
Daniel,

Glad to hear you've got it working.

Whatever the problem was, I doubt if it was directly connected with the fact that the form was top level. It's more likely to be something in the calling sequence or the call stack. Top-level forms don't behave any differently from other forms in that regard.

Regarding the differences in the environment settings, keep in mind that many settings are scoped to the current data session. If a form (top-level or otherwise) has a different data session than the main program, many SET commands will have different settings.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top