Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 04/25/22 in Posts

  1. DJof SD

    Parnassus Bookmarks for Delphi 11 Alexandria?

    Thanks for that feedback. I should look at what GExperts offers. Was that something from the initial offering or did you add that when you took over support? I guess what I am irritated with is the lack of communication and responsiveness by EMBT. As it is now, I use Parnassas without having to think about it. The change to another paradigm would be a disruption. Programming/debugging is enough of a challenge without having to slow down to think about how to do things in the IDE. </rant>
  2. You're right. I need to flush my long term memory of obsolete information 🙂. In Delphi 5 the tread was started immediately in the TThread constructor. Since Delphi 6 it is started in AfterConstruction.
  3. In general, there is nothing wrong with creating a TThread with CreateSuspended=False. That has worked just fine for the past 2 decades. So, unless Embarcadero has recently broken TThread, something else is likely going on.
  4. unit Unit1; interface uses system.Generics.Collections, system.Typinfo, system.sysutils; type TDynamicArrayFormatter<T> = class strict private FData: TArray<T>; FDimensions: TArray<cardinal>; FIndices: TArray<cardinal>; FType: PTypeInfo; strict protected procedure AddValue(aBuilder: TStringBuilder); function CalcLinearIndex: Integer; function GetText: string; procedure ProcessDimension(aDimension: Cardinal; aBuilder: TStringBuilder); public constructor Create(const aDimensions: array of cardinal; const aDataArray: TArray<T>); class function Execute(const aDimensions: array of cardinal; const aDataArray: TArray<T>): string; end; implementation constructor TDynamicArrayFormatter<T>.Create(const aDimensions: array of cardinal; const aDataArray: TArray<T>); begin inherited Create; SetLength(FDimensions, Length(aDimensions)); Move(aDimensions[0], FDimensions[0], Length(FDimensions) * Sizeof(Cardinal)); FData := aDataArray; FType:= TypeInfo(T); SetLength(FIndices, Length(FDimensions)); end; procedure TDynamicArrayFormatter<T>.AddValue(aBuilder: TStringBuilder); var LValue: T; N: Integer; S: string; begin N:= CalcLinearIndex; LValue := FData[N]; case FType.Kind of tkInteger: S:= Pinteger(@LValue)^.ToString; tkUnicodeString: S:= PPChar(@LValue)^; else S:= 'unknown type of T'; end; aBuilder.Append(S); end; function TDynamicArrayFormatter<T>.CalcLinearIndex: Integer; var I, N: Integer; begin Result := 0; N:= 1; for I := High(FDimensions) downto Low(FDimensions) do begin Inc(Result, N * Pred(FIndices[I])); N := N * FDimensions[I]; end; end; class function TDynamicArrayFormatter<T>.Execute(const aDimensions: array of cardinal; const aDataArray: TArray<T>): string; var LInstance: TDynamicArrayFormatter<T>; begin LInstance := TDynamicArrayFormatter<T>.create(aDimensions, aDataArray); try Result := LInstance.GetText; finally LInstance.Free; end; end; function TDynamicArrayFormatter<T>.GetText: string; var LBuilder: TStringBuilder; begin LBuilder := TStringBuilder.Create; try ProcessDimension(1, LBuilder); Result := LBuilder.ToString; finally LBuilder.Free; end; end; procedure TDynamicArrayFormatter<T>.ProcessDimension(aDimension: Cardinal; aBuilder: TStringBuilder); var I: Cardinal; LAddValues: Boolean; begin aBuilder.Append('{'); LAddValues := integer(aDimension) = Length(FDimensions); for I := 1 to FDimensions[Pred(aDimension)] do begin FIndices[aDimension-1] := I; if LAddValues then begin if I > 1 then aBuilder.Append(','); AddValue(aBuilder); end else ProcessDimension(Succ(aDimension), aBuilder); end; aBuilder.Append('}'); end; end. Usage like var S: string; begin S:= TDynamicArrayFormatter<string>.execute([1,2,2], ['one','two','three','four']); WriteLn(S); end;
  5. Lajos Juhász

    Detect if WebView2 Runtime is installed

    You can inspect the registry as documented here: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#detect-if-a-suitable-webview2-runtime-is-already-installed
  6. adrianlmm

    Async dialog on android?

    For FMX to support something like "modal" dialogs the compiler needs to support something like Async, Await, but currentlt it doesn't, for example, I can show a dialog in Flutter and waith for the result with code like this: var data = await showDialogAndWaithForAnswer(); // do something with data later. Meanwhile, the current solution for FMX makes the developer to change the logic and way of programming for one that is not as good as the one we are acustomed.
  7. brummgrammierer

    F6 Search feature does not work anymore?

    I find that whenever IDEInsight gets stuck (currently running mostly 10.3.3) the following rain dance helps: Open the IDE options (Tools > Options...) Type anything into the search field there: Close the options For me the F6 search works after that 100% of the time 🤷‍♂️
  8. It works well. I've managed to build and run my VCL and FMX projects on Android, iOS, Windows and Mac without any problems. Note that both Windows ARM and the way it runs Delphi are still in preview so tread carefully! I can debug Windows and Android no problem. I'm having issues debugging iOS as it's stopping in the IDE but showing the CPU rather than code views. I believe this might be a badly built component I need to re-install rather than an issue with the environment but can't confirm either way at the moment.
  9. david_navigator

    Has anyone tried running Delphi on Windows ARM?

    Is it only me that thinks it's funny that it's faster to run Windows via an emulator on a non-native platform, than it is to run Windows directly on Intel ?
×