Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 07/10/21 in all areas

  1. It needs some code to be added, but you can declare a const array[<enumeration>] of Integer with values 0 in all places where the enumeration is used in some way. const cCheckProjectType: array[TProjectType] of Integer = (0, 0, 0, 0); If you now extend TProjectType the compiler will stop at all places where such a declaration is present and you can inspect the code around for correct TProjectType usage. After that is done you extend the array values to make the compiler continue to the next problematic position.
  2. dkounal

    Notifications in android

    I can confirm that with the help of Dave Nottage (DelphiWorlds) using API from Kastri, I can have notifications in android with a progress bar. Many many thanks for his time.
  3. Not a fancy solution, but have you considered using a List? You can load all your types ( or only the required ones) with a simple loop. lPrjList := TList<TProjectType>.Create; lPrjList.AddRange([ ptMain, ptExternal, ptDivision, ptBranch ]); You can set the "list" with the types you need and pass it as required. Anyway, you no longer would require to check your code for "case" or keep track of "projecttype" changes. Just let the "process" add the required project type in the list and a routine would deal with what's inside. If you need some extra boost, you could link each projectType to a specific method to get called ( or a Class, or an interface ) by using a dictionary (or another more suitable data structure). Anyway, my $0.02
  4. Try overloading to extend your codebase. Or explore it in this case //existing procedure SaveProjectNames(aProjNames: TProjectNames); overload; begin xProjectNames := aProjNames; end; //add procedure SaveProjectNames(aitems: TStrings); overload; begin ... for switches in Atems SaveProjectNames(switches[0],switches[1], False); end; // this overload wants three args need to set the extra args to False in existing procedure SaveProjectNames(abMain, abXXX, abCountry: Strings); overload; begin If abMain = 'C' do stuff If ... //If abCountry end; force the compiler to use new procedures with fixed number of Args ie comment out original to find the aberrant code or missing switches. You would add an overloaded procedure when argument count needs change. (* procedure SaveProjectNames(aProjNames: TProjectNames); overload; begin xProjectNames := aProjNames; end; *)
  5. Not sure if I got your point right, you want a message/crash if a new type is added on the enum, to get noted, right ?
  6. FPiette

    Excel to DBGrid

    Export the Excel sheet as a CSV file which is a text file that you can easily parse with Delphi. Or automate Excel from your Delphi application to get the cells. Probably other solutions exists.
  7. Idefix Pack: Sounds a little strange to me, at least in German, like to order the dog to grasp
×