Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 01/26/23 in all areas

  1. No, because the parameterless TObjectList<T> constructor sets OwnsObjects to True. And that is nothing new but also already was the case in the old TObjectList from Contnrs.pas I am glad I can use Spring4D and have several flavors of multimaps at my disposal
  2. Stefan Glienke

    What are the correct settings for "Code inlining control"?

    It is from my own experience and analyzing generated code in several different scenarios. I have seen the inliner generating like x times more instructions including ridiculous amounts of mov instructions to and from the stack just to inline a harmless little function which it could way better if the inliner and the register allocator would not have been absolute trash. Plus there are "funny" little issues like this: https://quality.embarcadero.com/browse/RSP-30930 Here is an example where inlining creates some ridiculous amount of instructions: https://quality.embarcadero.com/browse/RSP-31720 (which is not caused by auto but the fact that the getter is being marked as inline)
  3. stacker_liew

    Why AV happen here

    Finally I managed to solve this problem, by using different FrameStand for different Frame. TFrameStandDemo.7z
  4. David Heffernan

    Convert Png To ico fmx delphi

    You could search for a library with support for this. Otherwise the ico format is very simple and comprehensively documented.
  5. programmerdelphi2k

    Tlistview SQLite pagination

    ok!
  6. Gary

    Click button from WVBrowser

    @salvadordf I figured it was a matter of drilling down to the element. 3 hours later after much trial and error, Success!! So frustrating spending so much time for what you already know is going to be 1 or 2 lines of code because of your ignorance but satisfying when done. Thank you so much.
  7. We are using the built-in TEdgeBrowser which is sufficient for our needs. I am guilty of taking the quick & dirty way out of Edge blocking local files by default. In one of our projects where we needed it, I simply have: Win32Check( SetEnvironmentVariable( 'WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS', '--allow-file-access-from-files' ) ); right in the DPR file. Above it is some kind of //TODO: Patch Vcl.Edge.pas so this is no longer necessary. Overall, I'm rather happy with the Edge Browser. We are using it to play videos, display and annotate PDFs, display web content and using rich HTML content editors like SunEditor.
  8. VmWare VM is not working under Parallels for me, at least not the ones I want to. There is a conversion tool, right in the beginning, which immediately fails with little or no errors. Even the Parallels support couldn't solve that, so I have to re-create a clean Parallels VM anyway. More headache to come, it seems that Parallels VM on Intel cannot be ported easily between Parallels M1. Only exchange by copy disk data is a way they provide. https://kb.parallels.com/125344 So then a breakdown of Macos-Intel will require a brand new VM-Setup under M1 anyway, and M1 will be the next Macos for sure, as I think Macos-Intel will be deprecated. Parallels VMs are not interchangeable between Intel <-> M1, no matter if TPM. Copying of harddrives should be easily possible, if not using Bitlocker ( encrypting by TPM ), which I do not consider to use in my VMs, so thats OK for me, but I thought the TPM will encrypt or certify some parts of the Windows-OS. https://www.linkedin.com/pulse/windows-11-requires-tpm-what-why-matters-rand-morimoto Ok, at least the VM data seems to be safe by direkct access of the hard drive files, but the OS and probably all installations and configurations of applications seems to be lost. Microsoft says https://learn.microsoft.com/en-us/windows/security/information-protection/bitlocker/bitlocker-countermeasure Is this meant as an option, when Bitlocker is activated ? From my assumption TPM is doing the latter, no matter if Bitlocker is activated, or not. If TPM recognizes any changes, then it prohibits booting the OS and I assume this cannot be reset somehow. It seems my TPM-less days will be gone soon and I have to optimize the process of setting up a new, clean VM ( which I already did ). At least the cloning and copying from "template VM" seems to work still on the same machine. From my tests I can use the Parallels "Clone" function, as well as the copy-and-paste of the *.pvm images, to create a derivate of my template VM. The derivate VMs seem to stay activated, as far as I can see. Conditions: No Bitlocker used, No more than one of the "cloned VM" active at a time
  9. type TObjectDictionaryWithDuplicateObjects<K,V:class> = class(TObjectDictionary<K, TObjectList<V>>) public procedure AddObject(const Key: K; Value: V); end; procedure TObjectDictionaryWithDuplicateObjects<K, V>.AddObject(const Key: K; Value: V); var list: TObjectList<V>; begin if not TryGetValue(Key, list) then begin list := TObjectList<V>.Create; Add(Key, list); end; list.Add(Value); end;
  10. David Heffernan

    "Divided by zero" exception

    Why let lack of knowledge get in the way of offering suggestions?
  11. Stefan Glienke

    What are the correct settings for "Code inlining control"?

    I would never ever turn it to AUTO because that causes the compiler to inline every function that has a size of 32 bytes or less. The inliner of the Delphi compiler is really bad and while one might think that inlining code usually makes stuff better/faster that is not the case and usually (decent) library developers know where to put inline and where not to put inline.
  12. You might want to turn inlining on for debug builds if what you are trying to debug might be releated to inlining. But in most cases I would also turn it off because it is really annoying if you can't step into a function because it was inlined.
  13. We just released a new update of our software yesterday, built with Delphi 11.2. Unfortunately our customers now complains that keyboard shortcuts no longer works. This has already been reported in quality portal, but unfortunately we did not discover this in time: https://quality.embarcadero.com/browse/RSP-39902 The problem happens in Actions with all F1 - F12 shortcuts, numerical keyboard shortcuts and more. Except from that, our Delphi 11.2 built app works well on all platforms (Windows, Mac, Android and iOS).
  14. programmerdelphi2k

    Tlistview SQLite pagination

    to avoid more clicks... procedure TForm1.Button1Click(Sender: TObject); begin CustomerTable.ParamByName('N').AsInteger := LNextRecord; CustomerTable.Refresh; CustomerTable.Last; // if (LNextRecord >= CustomerTable.RecordCount) then // not more records... Button1.Enabled := false; // LNextRecord := LNextRecord + LDBGridVisibleRows; // CustomerTable.MoveBy(-LDBGridVisibleRows) end;
  15. programmerdelphi2k

    Tlistview SQLite pagination

    using "Dataset" (FireDac or any other) you can try this: after your "SELECT" here my sample using a EMPLOYEE Interbase db: "SELECT * FROM CUSTOMER ROWS :N " --> N = param "Integer" implementation {$R *.dfm} //type // TMyHack = class(TDBGrid); var LDBGridVisibleRows: integer; LNextRecord : integer; procedure TForm1.FormCreate(Sender: TObject); begin LDBGridVisibleRows := 10; // TMyHack(DBGrid1).RowCount; // or your LV visible items on screen!!! LNextRecord := LDBGridVisibleRows; // CustomerTable.Open; end; procedure TForm1.Button1Click(Sender: TObject); begin CustomerTable.ParamByName('N').AsInteger := LNextRecord; CustomerTable.Refresh; CustomerTable.Last; // LNextRecord := LNextRecord + LDBGridVisibleRows; // CustomerTable.MoveBy(-LDBGridVisibleRows) end;
  16. programmerdelphi2k

    Tlistview SQLite pagination

    @toufik then, you would can try some like this: no pagination, in fact, but just increase the param used in "LIMIT" in your select ex.: 1 ... 20 = 20 records on LV 1... 40 = 20 + 20 records on LV 1... 60 = 20 + 20 + 20 .... etc... YourQUERY.Text := SELECT ... from TableXXX LIMIT "n" --> n= 20, n=40, n=60, etc... you can try use "params" in your select to change the value in "n" YourQUERY.Last ---> go to last record on screen or any other way to show last 20 records in your LV LiveBinding use o "BindSourceDB" then you try this: "BindSourceDB1.DataSet.Last"
  17. maybe my sample can help you to start... implementation {$R *.dfm} uses System.Rtti, Unit2; procedure TForm1.Button1Click(Sender: TObject); var LCtx : TRttiContext; LType : TRttiType; LProp : TRttiProperty; LPropParent: string; begin LCtx := TRttiContext.Create; for LType in LCtx.GetTypes do begin if (LType.TypeKind = tkClass) { TRttiInstanceType } and { } (LType.IsInstance) and { } (LType.AsInstance.MetaclassType.InheritsFrom(TMyClassXXXX { myClass } ) or { } LType.AsInstance.MetaclassType.InheritsFrom(TForm { myClass } )) then begin Memo1.Lines.Add(slinebreak + { } LType.Name + ', ' + { } LType.AsInstance.MetaclassType.UnitName + ', ' + { } LType.AsInstance.MetaclassType.UnitScope); // for LProp in LType.GetProperties do if (LProp.Name = 'Width' { myPropetyName } ) then begin LPropParent := 'Parent=nil'; // if (LProp.Parent <> nil) then LPropParent := 'Parent=' + LProp.Parent.ToString; // Memo1.Lines.Add('..... property: ' + LProp.Name + ', ' + LPropParent); end; end; end; end;
  18. Please see these earlier posts on SynEdit history: SynEdit preferred version? - Delphi Third-Party - Delphi-PRAXiS [en] (delphipraxis.net) Turbo SynEdit & Font Ligatures - VCL - Delphi-PRAXiS [en] (delphipraxis.net) DirectWrite and Unicode support One of the major flaws of SynEdit was the poor handling of Unicode. A major update has been committed to the TurboPack fork, that employs DirectWrite for text painting and fixes Unicode support. SynEdit should now be on a par with, if not better than, the best editors around with respect to Unicode handling. For example: Chinese is properly spaced and surrogate pairs and color emojis are fully supported: Bidirectional text editing is fully supported as well: WordWrap has been re-written and is now based on DirectWrite as well. This last update also includes other enhancements as for example an option to alpha blend the selection, another option for selection to cover just selected text instead of full lines, as in VS code and other editors, and horizontal mouse wheel scrolling: Other recent improvements: The undo/redo system was buggy and a mess, getting in the way of implementing new features. I has been reimplemented from scratch. The gutter has been reimplemented from scratch and is now flexible and extensible. A track changes bar like in Visual Studio has been added and unlike Delphi's it saves and restores line state correctly on undo/redo. The code base has been refactored cleaned-up, and partially documented, yet, and despite of the new features, it is thousands of lines shorter than the original. But a lot more can be done in this area. See here for the full list of enhancements in the the TurboPack fork. Backward compatibility Turbopack Synedit remains compatible with earlier versions of Synedit, but you do need to reinstall Synedit, load forms that use SynEdit ignoring error messages and save them again for the new properties to take effect. The use of DirectWrite though means that Windows XP is no longer supported. The TurboPack SynEdit fork supports Delphi versions Berlin or later. Future plans The next big planned feature is multi-selection and multi-cursor editing. Support the project Most of the bugs remaining in the issue tracker are C++Builder related. Also, the C++ packages have not been updated yet. We are actively seeking contributions on the C++Builder side of things (package updates, bug fixes). Of course you can also support the project by submitting bug reports and pull requests. Or, by implementing new features (e.g. minimap, Sync Edit like in Delphi, Delphi or VS-code like templates etc.) Note: Many thanks to @MarkShark for his great contributions to the SynEdit project.
  19. dados

    SynEdit just got a major uplift

    Well pyscripter rolled up his sleeves and has made the latest version the fastest one ever. Loading a 10Mb xml file with a a single line or a 120Mb with 3.3 million lines is now amazingly fast, even with highlighting. Thank you @pyscripter for your great work
  20. Gustav Schubert

    Component for GIF animation

    What happens if you test out TMediaPlayer on Android? It seems to work on Windows. procedure TFormMain.FormCreate(Sender: TObject); begin { TMediaPlayerControl component instance } MediaPlayerControl.Align := TAlignLayout.Client; MediaPlayerControl.MediaPlayer := MediaPlayer; { TMediaPlayer component instance } MediaPlayer.FileName := 'TestGif.gif'; MediaPlayer.Play; end;
  21. Primož Gabrijelčič

    Planning for V4 (FMX support)

    There is work being done (sporadically) in https://github.com/gabr42/OmniThreadLibrary/tree/v4-develop-2 Current status is: low-level tasks work on Linux, except when they don't and everything locks up hard. (And I have no idea yet why that happens.)
  22. How can I update the UI from a task using invoke. In my example below the memo is updated but with the wrong values procedure TMyForm.TestTask(const Task: IOmniTask); var i: Integer; begin for I := 0 to 4 do Task.Invoke(procedure begin mmoLogs.Lines.Add('['+i.ToString+']'); end ); end; result is [4] [4] [4] [4] [4] I need it to be [0] [1] [2] [3] [4] How can I achieve this?
  23. gorepj

    Updating UI using Invoke

    Oh, one last thing if I may Primoz, is this approach any better or worse than using Task.Comm.Send with a message handler in an onmithreadmonitor? regards
  24. Primož Gabrijelčič

    Updating UI using Invoke

    Tricky, got me completely dazzled for a moment 🙂 You are now generating new capture proc for each `I`. That `Proc`, however, is just a pointer. Now your code `Task.Invoke(procedure begin Proc(); end);` captures this `Proc` by value and executes the last stored value three times. You should do it like this: function CaptureValue(Value: Integer): TOmniTaskInvokeFunction; begin Result := procedure begin Memo.Lines.add(Value.ToString); end; end; for I := 0 to 2 do begin Task.Invoke(CaptureValue(i)); end;
  25. gorepj

    Updating UI using Invoke

    Thank you for your answers again. The scenario doesn't lend itself to a Consol app. So here is a test case using a form with a button and a memo. I tried also using the array of TMyProc and that also did not work. I kept getting access violations. My goal actually is to learn the best practice simple approach in updating the GUI from within a running IOmniTask thats all. Just like Synchronize from a TThread but the Omnithread way. I thought it may be using invoke but maybe its perhaps using Comm.Send to an omnithreadMonitor. unit OTLInvokeMain; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, OtlTask, OtlTaskControl, Vcl.StdCtrls; type TMyForm = class(TForm) Memo: TMemo; Button: TButton; procedure ButtonClick(Sender: TObject); private { Private declarations } procedure TestTask(const Task: IOmniTask); public { Public declarations } end; var MyForm: TMyForm; implementation {$R *.dfm} procedure TMyForm.ButtonClick(Sender: TObject); begin createTask(TestTask). Run; end; procedure TMyForm.TestTask(const Task: IOmniTask); type TMyProc = reference to procedure; function CaptureValue(Value: Integer): TMyProc; begin Result := procedure begin Memo.Lines.add(Value.ToString); end; end; var i: Integer; Proc: TMyProc; begin Task.Invoke(procedure begin Memo.Lines.Add('Test 1 - Using Invoke (Outputs same value each time)'); end ); for I := 0 to 2 do Task.Invoke(procedure begin Memo.Lines.Add(i.tostring); end ); Task.Invoke(procedure begin Memo.Lines.Add('Test 2 - Using Invoke with TMyProc and CaptureValue (Outputs same value each time)'); end ); for I := 0 to 2 do begin Proc := CaptureValue(i); Task.Invoke(procedure begin Proc(); end ); end; end; end. OTLInvoke.dpr OTLInvokeMain.dfm OTLInvokeMain.pas
×