Where should I put my utilities? How can I use my individual form? (Delphi)

I have been using Delphi for a little over a month, but I still don't know how to do it right.

If I have methods that I can use in many projects, should I put them in a Unit, form or DataModule? I did not use the block (by itself), New-> Unit. Should I put my utilities there? If so, is there an example that I can look at, a textbook or something else. I have used DataModules in the past, although it gives me the impression that it should only be used when I am dealing with databases, etc.

Another thing, I customize some forms (for example, a form with some TEdits that do certain things). To use this, first add this to use in .dpr
CustomizedForm in '\CForm\CustomizedForm.pas' ;
then I add CustomizedFormto use in my main form (where I will use it).
Is this the right way to do this? I just guessed it seems to work, although I'm not really sure if this is the right way.

+3
source share
3 answers

, , . , , , , . - . , .

, . , , . , , TImageList, , . - , , .

, , . , ( , , ), . ( , .)

, , Delphi . , - , . , Delphi, , Show ShowModal, , Release Free ( TForm.Release , , ), .

+3

utils.pas. .

, , , .

: Delphi

Delphi Zarko Gajic, .

"" . " Camtasia" . Turbo Delphi, , - Delphi , - Delphi.

+5

- StringUtils.pas, MathUtils.pas, DateTimeUtils.pas .. - ( , ...) .

Delphi Project , .

, ..

I myself create a group of projects that includes the package MyProjectUtils.bpl, and I put all my utility modules and classes in this package. I never deploy it as a package, but since they are wrapped together, I can always verify that they all compile correctly, and that they are all immediately available for viewing in the IDE, etc.

+1
source

Source: https://habr.com/ru/post/1754533/


All Articles