View Full Version : How to use multiple forms in one project tutorial up!
kornalius
10-13-2006, 12:12 PM
We have a new tutorial on how to use multiple forms in one project.</p>
Check it out:</p>
<a href="/page.php?44">http://www.arianesoft.ca/page.php?44</a></p>
</p>
David Chua
10-19-2006, 02:54 PM
When using the recommended method the following error occur: "Class PLLForm is already defined for a regular window, use another class name for dialogs". The opcode that generated this error is: NEWDLG.
However, when I click on the OK button on the error dialog window, the program continue to work normally.
Please advise.
Thanks.
kornalius
10-19-2006, 05:22 PM
You need to use another classname for the dialog form. You cannot have the same classname in the same project.
David Chua
10-20-2006, 01:29 AM
Yes, I've over look on the Class name. It's OK now.
However, the form ID has to be change as well. VFB default all forms with Form100, in multi form application you will have to change the form ID otherwise, the compiler will complain on the duplicates. Correct me if I'm wrong.
Cheers.
kornalius
10-20-2006, 11:15 AM
I don't think so. The ID's a relative to each form. The form ID is not very relevant to Windows API I believe. The Windows API uses the form handle instead. A button ID 100 can appear on two forms the form handle will be transfered to the WinProc with the ID in the parameters. So it should cause any trouble.
David Chua
10-20-2006, 12:44 PM
The button IDs are ok. By the way, it's more of the form name actually. Normally, the form name uses its ID to form the name such as Form100, when the VFB generate the code the function performing the task will then be "Form100Proc" and this is the name that gets conflic with the main window or form which has the same procedure name.
I hope you know what I mean.
Cheers.
kornalius
10-20-2006, 01:08 PM
Yes the names will need to be different you are right. I will have to come up with something for the next release 1.1. I'll add it to my list.
David Chua
10-21-2006, 01:26 PM
Hi Kornalius,
I've tested the multi-form further: Only two thing affected the operation, "Form100Create" and "Form100Proc" which are default. I was thinking you could use the "ClassName" when selecting option to create library. For example, I'm creating a form for configuration purposes so I use the classname as "ConfigForm" therefore, the code will generate "ConfigFromCreate" & "ConfigFormProc". No other changes required. Further more, it will be easy for me to remember and to call my from, the classname say it all. Hope this helps.
Cheers.
kornalius
10-22-2006, 09:07 PM
You can rename the Form name to whatever you like you know?
Instead of Form100 change the &Name property to ConfigForm. Then the code generator will use ConfigFormCreate.
kornalius
10-22-2006, 09:10 PM
The problem we will have to solve are the duplicate functions for the controls with the same name in two different forms.
Ex:
MyButton_OnClick on form1 and form2.
We might have to use MyForm_MyButton_OnClick to solve the issue.
David Chua
10-23-2006, 12:29 AM
Add/use the classname would be nice in this situation, the calssname got to be different afterall. Besides, it will be easy to be indentified as well. For example, if the new form is "Config" then: ConfigForm100, ConfigFormProc, ConfigForm_Button101..., ConfigForm_Edit102... and etc...
Cheers.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.