Forum > Designer

Problem créate form

<< < (3/4) > >>

Fabius:
Error duplicate !

GetMem:
@Fabius

Please post your project as attachment, source only, there is a 250 kB limit.

devEric69:
You have 2 different concepts, named with the same name, i.e. you have still homonyms!!? ==> a unit called formliasses.pas AND a global variable called var formliasses: ...\... ==> rename your unit as uFormliasses.pas and its first line (header) must be unit uFormliasses; .


Please use "case sensitive" for your files naming convention (it's an option in Lazarus IDE), and for your variables, etc... And please, take a look at what is called Hungarian notation or Camel case, for sanitary maintenance of your code and to be sensitive to homonyms, AMHO.

dbannon:
Fabius, think you need to understand whats happening here.  There are three things in play -

Unit name.  That relates to all the content in one source file, it appears near the top of the file, on a line that says "unit unitname;".  The unit name is also used for the pas file and if there  is one, the lfm file.  To change it, you should, in the source editor, click File and Save As. The ide will save the editor content in the new file name and change the unit name.

Type Name. In the unit, you will probably have one or more declared Types.  Its a good idea to make a type name start with a capital T. In your case it looks like the Types you are dealing with are TForm dependents and are used to define what a form might look like.  One way to change a Type name (without a lot of typing) is to highlight the first use of the Type name (remember, it starts with T) and press F2, change all occurrences.

Variable Name. A variable is always of a particular Type and you can have one or more of them.  In your case here, the Type is a TForm descendant and that means each variable of that Type represents exactly one visible (or invisible) form.  You should change a TForm type variable using the Object Inspector, Name.

Three different things, they are have different uses and all are changed in different ways. And cannot have the same name else the compiler will not understand which one you are talking about.

When you make a new form in the IDE, it helps you by giving those three different things default names, eg Unit2, TForm2 and Form2.  Good programming requires you to change those names to something that will help you remember what they are for. If the form is about "liasse", maybe its as WP suggested, the unit changes from Unit2 to uLiasse, the Type from TForm2 to TLiasse and the form itself changes from Form2 to Liasse, or maybe FormLiasse ?  Use the IDE functions mentioned above to change them as soon as you add the new form to your project.

Davo

Fabius:
Thank you for your help ;)

I ended up making it work

But I don't understand why this problem with unit names

cordially to all ;D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version