Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/21/18 in all areas

  1. Stefan Glienke

    Custom Managed Records Coming in Delphi 10.3

    Better than releasing something that is broken and makes all your code fail, amiright?
  2. Cristian Peța

    Strange and Random Access Violations

    It can brake reference counting only if you move() to string. When you only move() from string the string is not affected in any way. Move() doesn't change the source.
  3. Stefan Glienke

    For..to..step in Delphi

    @Arnaud Bouchez I know you like to deal with low level stuff but being able to be more declarative about loops and other language constructs is a benefit imo. That var passing of the loop variable is bad, but Primoz wrote that just for fun and advised not to use it. I guess every Delphi developer knows how a while or repeat loop works but I have seen enough off by one errors caused by counting the loop variable wrong, messing up the loop condition or other stuff which could just be eliminated if the language itself could treat it right without the need to put extra abstractions ontop that just make code slower. Another thing that just applies to 10.3 though is that only in a for loop you can inline declare the variable to only be valid in the loop scope and not outside.
  4. Unfortunately the introduction of custom managed records has been deferred to version 10.4 See http://blog.marcocantu.com/blog/2018-november-deferring-managed records.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+marcocantublog+(marcocantu.blog) Pity, since I can see many important use cases for this language enhancement. Guess I will have to bide my time another year.
  5. The Owner is not necessarily the form. Sometimes the owner is a TFrame descendant or may even be nil. Iterating the Parent until a TCustomForm is found is usually the way to get the required form instance. Perhaps iterating until Parent is nil is another valid approach. That would also cover the case where one form is parented into another one.
  6. See my latest blog post at http://blog.marcocantu.com/blog/2018-nov-vcl-permonitorv2_getsystemmetrics.html
  7. Fritzew

    Access violations when closing the IDE

    Yes, there is something with Synedit...... But not every time I will compile it with Madexcept enabled, maybe I will see more
  8. Marco Cantu

    VCL Support for Per Monitor v2 and GetSystemMetrics Coming in 10.3

    Actually I was imprecise. It doesn't use the parent handle, but walks over the parent hierarchy up to the containing form
  9. Lars Fosdal

    For..to..step in Delphi

    Not efficient, not tested, but fun 😄 User exercise - make a Range.AsDouble(0, 5, 0.25) type Range = record class function AsInt(const aFrom, aTo: Integer; const aStep: Integer = 1): TArray<Integer>; static; procedure Test; end; class function Range.AsInt(const aFrom, aTo, aStep: Integer): TArray<Integer>; var ix, n: Integer; v: Integer; begin n := ((aTo - aFrom) + 1) div aStep; SetLength(Result, n + 1); v := aFrom; ix := 0; while v <= aTo do begin Result[ix] := v; v := v + aStep; end; SetLength(Result, ix + 1); end; procedure Range.Test; var ix: Integer; begin for ix in Range.AsInt(0, 11, 2) do begin Writeln(ix); end; end;
  10. Hi all, (Apologies for late reply) Pulled latest source & all packages build now, problem solved thanks. Yes, I am using 10,1 Berlin - sorry should've mentioned that. Kindest regards
  11. Fritzew

    Strange and Random Access Violations

    Can you tell us why you think these is right? There is no reason for this construct. Length(s) is enough .
  12. Arnaud Bouchez

    For..to..step in Delphi

    Just use a while loop! This is the clear and efficient way of writing such code, without messing with the "for" variable. var i: integer; begin i := 1; while i <= 10 do begin Writeln(i); inc(i, 2); end; Readln; end. Or a repeat .. until of course: var i: integer; begin i := 1; repeat Writeln(i); inc(i, 2); until i > 10; Readln; end.
  13. Kryvich

    Strange and Random Access Violations

    function StringToCharArray(const S: string): TCharArray; begin PChar(Result) := PChar(S); end;
  14. David Heffernan

    Strange and Random Access Violations

    You write a zero byte beyond the end of the char array. Solve the problem by using Move to perform the copy.
  15. FredS

    For..to..step in Delphi

    From Marco: Stepping through Values in a Delphi for Loop There has been a recent request to add to for loop in the Object Pascal language the ability to add a step, that is an increment different from one. Here is an alternative implementation using a for..in loop and a custom enumerator.
  16. Attila Kovacs

    Strange and Random Access Violations

    it's in the help Note: Dest should point to a location with room for MaxLen + 1 characters, including the null terminator. too bad that the compiler can't detect the out of range
  17. Tom F

    Stay-on-top for just our app?

    I have determined that this problem is being caused by DisplayFusion, a wonderful program to handle multiple monitors and multiple task bars. If I disable DisplayFusion from adding title bar icons to any application, (these are buttons that allow one to easily move a window to another monitor), the problem goes away. I have contacted them for support. I have been using this program for many years and really value the various screen management tools it provides, especially title bar buttons and a task bar on each monitor that shows only the apps that are running on that monitor. I'd hate to not have the DisplayFusion tools available (and frankly would probably to use it even with the nuisance of non-modal windows burning through in the debugger), so I'm really hoping they will come up with a fix. Thanks to everyone here for their support and suggestions.
×