-
Content Count
491 -
Joined
-
Last visited
-
Days Won
6
Tommi Prami last won the day on August 12 2023
Tommi Prami had the most liked content!
Community Reputation
122 ExcellentTechnical Information
-
Delphi-Version
Delphi 12 Athens
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Interesting take on Binary search (FYI)
Tommi Prami replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
Did not know that. Thanks for info... -Tee- -
Interesting take on Binary search (FYI)
Tommi Prami posted a topic in Algorithms, Data Structures and Class Design
No idea how it would be done, but for more than less static lookup list etc, this could be very good idea. -
How to make "dynamic initialization" procedure
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
True, Calculating the sum was just placeholder of some calculation going on in the loop But very true, if can get sum forehand, would be smart to get it. -Tee- -
How to make "dynamic initialization" procedure
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
As Uwe explained... -
How to make "dynamic initialization" procedure
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
Depends of number of calls and fields. If 8 field 50 places, it would be from 400 -> 50 lines of code. I think it would be significant, Would be net win after first one. And would make the procedure way more clean, without initialization code in it. -
How to make "dynamic initialization" procedure
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
Does not work, know because I've tried that approach in the past, and retried your code and it does nothing. (outside of procedure, which is the important part), // usage var Field1, Field2, Field3, Field4: TField; begin Field1 := nil; // ... Field2, Field3, Field4 ConnectFields(Query, [ Field1, Field2, Field3, Field4], ['Field1', 'Field2', 'Field3', 'Field4']); // Fields star as they are in here, nil or not nil, doesnt matter... But eassy to check by nilling the fields becore and after call. Other problem in this tat compiler starts to complain about Fields are uninitialized. But that is separate issue... -
How to make "dynamic initialization" procedure
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
Nice could be done something like that,. but field names are not indexed, usually and after that it is just the same as the my original example I am trying to solve... But Not looking for workaround... -Tee- -
How to make "dynamic initialization" procedure
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
Yes... But totally different thing... And would have exact same problem. Would need to initialize variables for indexes by name. Constant magic number indexes leads to buggy code. I am looking for solution for getting fields, and also solution for other cases I could adapt it to. Getting fields is just one use case of this type of procedure I would like to use... -Tee- -
How to make "dynamic initialization" procedure
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
var LTotal: Double; LField1: TField; LField2: TField; LField3: TField; LField4: TField; begin LField1 := Query.FieldByName('FIELD1'); LField2 := Query.FieldByName('FIELD1'); LField3 := Query.FieldByName('FIELD1'); LField4 := Query.FieldByName('FIELD1'); Query.First; while not Query.Eof do begin LTotal := LTotal + LField1.AsFloat; // More stuff done with local field variables... Query.Next; end; In this case, TDataSet and TField are RTL stuff or their descendants... So implementation should be kind that works if I have no control over the API of the class.. -Tee- -
How to make "dynamic initialization" procedure
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
In this case I get the field usually when they are needed in the loop, or get rid of with-clause or something like that. -
How to make "dynamic initialization" procedure
Tommi Prami posted a topic in RTL and Delphi Object Pascal
Hello, I was pondering folowin situation, where there are easily quite many repeating code lines, and how to make int onew liner. var var LField1: TField; LField2: TField; LField3: TField; LField4: TField; begin LField1 := Query.FieldByName('FIELD1'); LField2 := Query.FieldByName('FIELD1'); LField3 := Query.FieldByName('FIELD1'); LField4 := Query.FieldByName('FIELD1'); // ... // Should be nice to have it like this InitField(Query, [LField1, LField2, LField3, LField4], ['FIELD1', 'FIELD2', 'FIELD3', 'FIELD4', ]); It would be easy to make local procedure, case by case with var parameters etc, but that would not be very elegant. What I mean by dynamic, is that it would handle any number of fields and field names, oas long as there are same number of them passed to the procedure.. Other case would be that could pass local variables and the routine would create those objects for me on single line. -
What new features would you like to see in Delphi 13?
Tommi Prami replied to PeterPanettone's topic in Delphi IDE and APIs
Even something like 1.5 pass compiler that would enable some functionality or extend existing would be cool to have... -Tee- -
What new features would you like to see in Delphi 13?
Tommi Prami replied to PeterPanettone's topic in Delphi IDE and APIs
This would be good start. People in any teams have different level of eyesight. Different scaling needs etc. This should have been implemented from the start the way that values in dfm would have been normalized to 96 as default dpi. Or something like that. Sure there could have been rounding errors, most likely. -
Weird error on latest SVN source release build with D12 (fix versio)
Tommi Prami replied to Tommi Prami's topic in GExperts
Seems that my problem is not affecting all then... -Tee- -
Weird error on latest SVN source release build with D12 (fix versio)
Tommi Prami replied to Tommi Prami's topic in GExperts
Can someone build release version of GExperts with patched D12, with current sources? If can, could you share it for testing.