Jump to content

FabDev

Members
  • Content Count

    17
  • Joined

  • Last visited

Community Reputation

0 Neutral

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I confirm that HTMLLibrary is an awesome HTML library. Congratulation Alexander 😉 But for the SQL parser of HTML library I don't find how to transform this : Peter or "Bibi Paulo" and John to a where clause to search on a field : select xxx where Name containing 'Peter' or Name containing 'Bibi Paulo' and Name containing 'John'
  2. FabDev

    TListView filled by Thread = Freeze

    Thank you very much Dalija, your version work fine (tested on Windows and Android) . Thank you to all other for interesting answer !
  3. FabDev

    TListView filled by Thread = Freeze

    You means that : procedure TForm1.Button2Click(Sender: TObject); begin AniIndicator1.Visible := True; AniIndicator1.Enabled := True; ListView1.enabled:=false; ListView1.beginupdate; FMyThreadTerminated:=false; FMyThread:=TThread.CreateAnonymousThread(procedure () //TThread.queue(TThread.Current, procedure () // Total: Integer; var I: Integer; begin for I := 1 to MaxValue do begin TThread.queue (TThread.Current, procedure () begin ListView1.Items.Add.Text := 'Th: ' + I.ToString; Button2.text:= i.tostring; // On windows this is needed to update AniIndicator {$IFDEF MSWINDOWS} if (GetQueueStatus(QS_ALLINPUT) <> 0) then {$ENDIF} begin // Application.ProcessMessages; end; end ); if application.Terminated then begin break; end; end; TThread.queue (nil, procedure () begin NotifyComplete; end); end); FMyThread.FreeOnTerminate:=false; FMyThread.Start; end; But it's doesn't work ! But this work fine excepted my TAniIndicator on Windows which work only with a Application.processMessage, but it's work fine on IOS : procedure TForm1.Button2Click(Sender: TObject); begin AniIndicator1.Visible := True; AniIndicator1.Enabled := True; ListView1.enabled:=false; ListView1.beginupdate; FMyThreadTerminated:=false; FMyThread:=TThread.CreateAnonymousThread(procedure () //TThread.queue(TThread.Current, procedure () // Total: Integer; var I: Integer; begin for I := 1 to MaxValue do begin TThread.Synchronize(TThread.Current, procedure () begin ListView1.Items.Add.Text := 'Th: ' + I.ToString; Button2.text:= i.tostring; // On windows this is needed to update AniIndicator {$IFDEF MSWINDOWS} if (GetQueueStatus(QS_ALLINPUT) <> 0) then {$ENDIF} begin // Application.ProcessMessages; end; end ); if application.Terminated then begin break; end; end; TThread.queue (nil, procedure () begin NotifyComplete; end); end); FMyThread.FreeOnTerminate:=false; FMyThread.Start; end;
  4. FabDev

    TListView filled by Thread = Freeze

    It's work but now to have my TAniIndicator and button2.text changing I have had to call Application.ProcessMessages on each platform (Windows, IOS, MacOs...) : procedure TForm1.Button2Click(Sender: TObject); begin AniIndicator1.Visible := True; AniIndicator1.Enabled := True; ListView1.enabled:=false; ListView1.beginupdate; FMyThreadTerminated:=false; FMyThread:=TThread.CreateAnonymousThread(procedure () begin TThread.queue (TThread.Current, procedure () var I: Integer; begin for I := 1 to MaxValue do begin ListView1.Items.Add.Text := 'Th: ' + I.ToString; Button2.text:= i.tostring; // On windows this is needed to update AniIndicator {$IFDEF MSWINDOWS} if GetQueueStatus(QS_ALLINPUT) <> 0 then {$ENDIF} begin Application.ProcessMessages; end; if application.Terminated then begin break; end; end; end ); TThread.queue (TThread.CurrentThread, procedure () begin NotifyComplete; end); end); FMyThread.FreeOnTerminate:=false; FMyThread.Start; end;
  5. FabDev

    TListView filled by Thread = Freeze

    Thank you Dalija, now it's (seems ?) work fine like this : procedure TForm1.Button2Click(Sender: TObject); begin AniIndicator1.Visible := True; AniIndicator1.Enabled := True; ListView1.enabled:=false; ListView1.beginupdate; FMyThreadTerminated:=false; TThread.queue(TThread.Current, procedure () var I: Integer; Total: Integer; begin Total := 0; for I := 1 to MaxValue do begin TThread.Synchronize (TThread.CurrentThread, procedure () begin ListView1.Items.Add.Text := 'Th: ' + I.ToString; Button2.text:= i.tostring; // On windows this is needed to update AniIndicator {$IFDEF MSWINDOWS} if GetQueueStatus(QS_ALLINPUT) <> 0 then Application.ProcessMessages; {$ENDIF} end); if application.Terminated then begin break; end; end; TThread.Synchronize (TThread.CurrentThread, procedure () begin ListView1.Items.Add.Text := 'Thread: ' + Total.ToString; NotifyComplete; end); end); end;
  6. FabDev

    TListView filled by Thread = Freeze

    To not freeze application while inserting some records. Imagine record extracted from a query or a webservice. What is more while it's working it's display a TAniIndicator...
  7. FabDev

    TListView filled by Thread = Freeze

    Hello, Following this sample : https://blog.marcocantu.com/blog/2014_may_background_delphi_android_threads.html I try to insert items in a TlistView using a Thread (see in attachment). procedure TForm1.Button2Click(Sender: TObject); begin AniIndicator1.Visible := True; AniIndicator1.Enabled := True; ListView1.enabled:=false; ListView1.beginupdate; FMyThreadTerminated:=false; FMyThread:=TThread.CreateAnonymousThread(procedure () var I: Integer; Total: Integer; begin Total := 0; for I := 1 to MaxValue do begin // if (I * 10 mod MaxValue) = 0 then TThread.Synchronize (TThread.CurrentThread, procedure () begin ListView1.Items.Add.Text := 'Th: ' + I.ToString; Button2.text:= i.tostring; // On windows this is needed to update AniIndicator {$IFDEF MSWINDOWS} if GetQueueStatus(QS_ALLINPUT) <> 0 then Application.ProcessMessages; {$ENDIF} end); if application.Terminated then begin break; end; end; TThread.Synchronize (TThread.CurrentThread, procedure () begin ListView1.Items.Add.Text := 'Thread: ' + Total.ToString; NotifyComplete; end); end); // FMyThread.FreeOnTerminate:=false; // FMyThread.OnTerminate:=ThreadTerminated; FMyThread.FreeOnTerminate:=false; FMyThread.Start; end; It's work fine on Windows and IOS except if you quit the application while thread (To insert item) is running : Application freeze ! I use : procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin STopThread; end; procedure TForm1.StopThread; begin if Assigned(FMyThread) then begin FMyThread.Terminate; WaitForSingleObject(FMyThread.handle,0); // FMyThread.WaitFor; //TerminateThread(FMyThread.Handle,0); access violation end; FMyThread.Free; end; What is wrong in my code ? I use Delphi 10.4.2. TListView-Thread.zip
  8. FabDev

    TListView first and last item visible

    Thank you for your really interesting answer. Unfortunately TlistView has no CustomDrawItem event on Firemonkey. That why I have used OnUpdateObjects event but it's doesn't work fine... And yes the methode GetItemRect can to the trick : r:Trectf; ... R := TListView(Sender).GetItemRect( AItem.Index); ... I use OnScrollViewChange event to load more event, it's work fine on Windows, but it's slow on MacOS (Without metal), IOS and Android.
  9. In most case (to not kill the battery of my Iphone there is no problem for Ipad) I debug via WIFI and it's work fine (compilation/installation/debug not Tethering). But I have tested with USB cable without change.
  10. Hello, Does someone know how to get first and last item index visible in a TListView ? Purpose : I use TlistView.OnUpdateObjects event to custom draw items and it's work fine. But it is very slow (with a certain number of items) because it is called for each items !
  11. Hello Philipp, Tested on IOS 14.6 with Delphi SDK updated it's style not work. Sorry but tested with your patch and it's worst because program crash at start in a access violation at 0000000104A0014 at adresse FFFFFFFFFFFFFFF78" in line : procedure TTetheringNetworkServerCommUDP.BroadcastData(const AData: TBytes; const AHost: string; InitialPort, FinalPort: Integer); .../... FUDPServer.Bindings.Sockets[J].Broadcast(LData, I, LHost); Before exception local values : InitialPort = 2020 FinalPort = 2039 LHost ='255.255.255.255' LData = 0x0000000282a00a30 "TetheringNewManager|192.168.1.56$2020|1|{4A03A28F-86DA-EB11-A88B-A1727F35E082}|TakePhotoManager|TakePhotoManager|2020~"
  12. Hello Philipp, I confirm for IOS 14 with Delphi 10.4.2. But it's work fine with MacOS Big Sur 11.4 (Mac Mini Intel 2014). It's even work from my VMware Windows 10, where is my Delphi 10.4.2, connected to my Mac Mini. My Mac Mini and my PC are connected throw Ethernet. I don't test connected via WIFI. So It's work in every direction : DesktopWallApp (MacOs 11.4 or Windows 10) MobilePhotoApp (MacOs 11.4 or Windows 10) I use it every day because I have developed my own Clipboard Sharing based on apptethering between my PC, Mac, Android. But it's only fail (no client/server detected) on IOS 14...
  13. Hello Anders, First congratulation for your great component that I use since more than 10 years ! If you are a namesake 😉 This copy now : https://github.com/landrix/The-Drag-and-Drop-Component-Suite-for-Delphi My problem is that I need drag&drop from a grid to another grid in another different form. Each form are always shown in task bar using : procedure TForm1.CreateParams(var Params: TCreateParams); begin inherited; Params.ExStyle := Params.ExStyle and not WS_EX_APPWINDOW; Params.WndParent := Application.Handle; end; But when the second form is only visible in taskbar (in background or minimized for example) it's doesn't react at the drag&drop (when mouse is moved over the form button in task bar). The destination form doesn't come in foreground like an application do when it's detect drag&drop. So I will try your solution....
  14. Hello, I use Drag and Drop Component Suite since a long time and its work fine. But I don't know how to handle drag&drop between 2 VCL applications (same application execute at same time for example). But not file or URL just "common" Delphi components. Just a TForm with a Tlabel. Tlabel.Drag : Unit17.pas unit Unit17; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TForm17 = class(TForm) Label1: TLabel; procedure Label1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); private { Déclarations privées } public { Déclarations publiques } end; var Form17: TForm17; implementation {$R *.dfm} procedure TForm17.Label1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); begin accept:=true; Showmessage('DragOVer from '+ Sender.name); end; end. Unit17.dfm : object Form17: TForm17 Left = 0 Top = 0 Caption = 'Form17' ClientHeight = 347 ClientWidth = 728 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel Caption = 'Drag Label' DragMode = dmAutomatic end end Between 2 components on the same form or application it's not a problem. But execute 2 times this application : Drag&drop from label1 in application 1 to label1 in application 2 is not working... How to handle drag&drop between this label in each running application ?
  15. FabDev

    Dynamic BPL loading (CData)

    Yes it's better to avoid ambiguity of "Self" but in this case by default Delphi seems to consider (Self=Form10). But I think that it miss something like (done in initialization of unit FireDAC.Phys.CDataExcel.pas) : FDPhysManager().RegisterDriverClass(TFDPhysCDataExcelDriver); But : AClass2 := GetClass('TFDPhysCDataExcelDriver'); Return nil...
×