PDA

View Full Version : Business Application


Gautxo
10-13-2006, 06:14 AM
I'm trying to do an small business application in PPL. I don't see clear how can I do a multiple forms application, or another method to present multiple screens to the user.

Can anyone tell me how can I do this? Thank you!

José Luis Cuesta
CEESA, S.A. - Spain.

kornalius
10-13-2006, 11:16 AM
Hi José,

There is a flag that you can set on all forms you don't want to be used has your main form.

In the PIDE, Form -> Form Options -> Generate Library. This will make sure the form is not auto-created and can be used as a library file. In your main form code to create the separate form, just use in your main form Initialization Code section:

#include "mynewform"

In you calling code just do the following:

f$ = MyNewForm_Create;
ShowModal(f$); // Or Form_Show(f$) for non-modal
Form_Destroy(f$);

Make sure the main form (.frm) file is selected as your project's Main file if you are using a project.

If you need more help please let us know.

Gautxo
10-13-2006, 04:44 PM
Is this line correct?

f$ = MyNewForm_Create;

I've obtain an error. I try also with "MyNewForm_Create" and with the name of the form FORM200 and don't work.

The line ShowModal tell me tha the parameters number is incorrect, and with the Form_Show function don't work.

Sure I'm doing some wrong, but I can't see what.

Thank You.

kornalius
10-13-2006, 05:35 PM
The information*in my post was erronous sorry about it.</p>

We have a new tutorial on multiple forms in PPL, check it out <a href=&quot;/page.php?44&quot;>here</a>.</p>

In your case it will need to be Form200Create and ShowModal(f$, NULL, false).</p>

Gautxo
10-13-2006, 07:11 PM
Thank you! Now works fine.

kornalius
10-14-2006, 01:28 AM
No problem.

Gerben
10-21-2006, 10:31 AM
Hi Everyone,

I am a newbie to PPL and I really like it. It looks like a complete and multifunctional programming environment.

I have done PalmOS C, C++ programming for the last few years but want to switch to developing for PocketPC/WinCE.

Now, I am trying to write a business app as well, I have studied the latest tutorial but I am still confused about how to juggle the forms.

Right now, I have 1 main form and 1 additional (data entry) form. When selecting a button on the main form, I create the second form in the button onclick event handler and show it. this works fine.

I do not want the second form to be modal, I have a close/ok button on this second form which should switch back to the main form.

When I use Form_Close in the button onclick event handler of the second form, the form indeed closes. According to the tutorial, I should also call Form_Destroy but when I do this I get some 'memory read' error.

Could you please tell me what I am doing wrong here?

Thanks a lot, greetings,
Gerben

kornalius
10-22-2006, 08:32 PM
Please send me the project attached. I will take a look at it and get back to you.

kornalius
10-22-2006, 09:01 PM
The following works great:

f$ = SecondFCreate;
Form_Show(f$);
Delay(1000);
Form_Close(f$);
Form_Destroy(f$);

Let me know if this is what you were doing...

Gautxo
10-23-2006, 05:47 AM
I had some similar problem. I had a button in the second form that had &quot;Form_Close(f$)&quot; and Form_Destroy(f$). This not do nothing (in my case).

I change it to this line:

PostMessage(hWnd$, WM_CLOSE, 0, 0);

and now works fine.

Gerben
10-23-2006, 08:22 AM
Thanks for your replies.

Kornalius, I have mailed you the project. Maybe I should not be destroying the form in one of the forms event handlers??

kornalius
10-23-2006, 05:49 PM
You should never try to destroy a form inside it's own code (event handler). Destroying the form from within its code will cause a crash it is innevitable.

You need to destroy the form outside it's code. Generally just a Form_Close(FRM_NEW$) will do the job.

Gerben
10-23-2006, 06:52 PM
I should have realized this earlier.....sorry.

Is there a need to call Form_Destroy or is all form-memory deallocated when a PPL program exits? I ask because I don't see this function called in any sample PPL code which contains just 1 form.

Maybe a basic question, but how do I let the main form know that the second form has been closed so I can safely call Form_Destroy?

These questions are maybe too simple, could be due to my non-windows background. I am just trying to grasp how PPL handles this all. Thanks!

kornalius
10-23-2006, 07:19 PM
No question is too simple.

PPL will free all windows at exit time. You don't really need to bother with destroying the window manually.

Gerben
10-23-2006, 09:12 PM
Thanks again for the help, I'll just forget about Form_Destroy then. ;)