Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

31 Excellent

1 Follower

About Serge_G

  • Birthday 06/29/1956

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

805 profile views
  1. Serge_G

    Create a bitmap of selected control?

    Ah, I knew I faced this GetItemRect somewhere ! It was when I compare the new VCL TControlList to FMX.TListView. In fact, I was deploring the lack of the method (not lack but private one) GetItemRect (I found in FMX.TListview) in the VCL.TControlList Was not so old finally, but other context . (webinaire sur TControlList partie sur le dragdrop) I quickly check and "joy" got the same results No mousemove event will fire, I think. And tracking the movement of the finger should be a real challenge
  2. Serge_G

    Interbase - Update & Select

    Hi, I have to put water in my wine even though it's a wine heresy I just read that the interbase 2020 update 2 allows recursive CTEs https://docwiki.embarcadero.com/InterBase/2020/en/What's_New_in_InterBase_2020_Update_2 so I do a first try (with firebird) not a good one SQL but as first attempt not so bad WITH RECURSIVE R AS (SELECT CUSTNO,1 AS LNo,Item,Price FROM TABLE_1 UNION all SELECT r.CUSTNO,r.LNo+1,Item,Price FROM R WHERE r.LNo< (SELECT COUNT(*) LINES FROM TABLE_1 WHERE CUSTNO=r.CUSTNO) ) SELECT CUSTNO,LNO,item,price FROM r Give me a first look, not a good one but an approximation
  3. Serge_G

    Create a bitmap of selected control?

    Note : in case of headers/footers a loop in the items till item index shall certainly do the job. My question : what event will you used to detect drag mode ?
  4. Serge_G

    Create a bitmap of selected control?

    I don't found the source I had in mind, but ... If there are no headers or footers procedure TForm1.ListView1ItemClick(const Sender: TObject; const AItem: TListViewItem); begin if AItem.Purpose=TListItemPurpose.None then begin memo1.Lines.Clear; memo1.Lines.Add('Item width '+(Listview1.width).ToString); memo1.Lines.Add('real Item width '+(Listview1.width-Listview1.ItemSpaces.Left-ListView1.ItemSpaces.Right).ToString); memo1.Lines.Add('Item Height '+Listview1.ItemAppearance.ItemHeight.toString); memo1.Lines.Add('real Item height '+(Listview1.ItemAppearance.Itemheight-Listview1.ItemSpaces.top-ListView1.ItemSpaces.bottom).ToString); memo1.Lines.Add('cursor '+Listview1.ScrollViewPos.ToString); memo1.Lines.Add(' Item toppos in list '+(AItem.index*Listview1.ItemAppearance.ItemHeight-Listview1.ScrollViewPos).ToString); memo1.Lines.Add(' real Item toppos in list '+(AItem.index*Listview1.ItemAppearance.ItemHeight- Listview1.ScrollViewPos+Listview1.ItemSpaces.top).ToString); end; end; With this, it's easy to make a bitmap extracted from ListView1.MakeScreenShot like this procedure TForm1.ListView1ItemClick(const Sender: TObject; const AItem: TListViewItem); var aBitmap : TBitmap; rect : Trect; begin if AItem.Purpose=TListItemPurpose.None then begin Rect:=TRect.Create(TPoint.Zero); Rect.Left:=Trunc(ListView1.ItemSpaces.Left); Rect.Top:=trunc(AItem.index*Listview1.ItemAppearance.ItemHeight-Listview1.ScrollViewPos+Listview1.ItemSpaces.top); Rect.Right:=Rect.Left+Trunc(Listview1.width-ListView1.ItemSpaces.Right); Rect.Bottom:=Rect.Top+Trunc(Listview1.ItemAppearance.Itemheight-ListView1.ItemSpaces.bottom); aBitmap:=TBitmap.Create; try aBitmap.Width:=Rect.Width; abitmap.Height:=Rect.Height; aBitmap.CopyFromBitmap(Listview1.MakeScreenshot,Rect,0,0); aBitmap.SaveToFile('itemtest.bmp'); finally abitmap.Free; end; end; end; result : Ok, I just forget to discount Scrollbar width, but that's the idea
  5. Serge_G

    Create a bitmap of selected control?

    Yes, even if I don't remember how I proceed. I will look for in my ('old') sources code tests. I remember there are some private properties but, but these memories are polluted by more recent tests on VCL.TControlList (sorry) As soon as I find these sources, I come back.
  6. Serge_G

    Interbase - Update & Select

    Well, I install Interbase and was rather disappointed! No context variables (a bypass : using a temporary table) nor windows functions . I don't investigate for Recursive CTE, but I am afraid there is not. How can that be possible as of today? I understand more Ann Harrison mother of Interbase/Firebird point of view. As quick as I install Interbase, I desinstall it ­čśľ really disappointed. I have no doubt there are good things in Interbase but my way is now Firebird (event if missing some crypto columns)
  7. Serge_G

    Interbase - Update & Select

    CTE, ok, but windows functions ? I am really disappointed if Interbase don't applies new SQL standard. Time is the key word, if I have some in future week I will install manually (because of 3050 port) Interbase 2020 Delphi version just to check what's new But there are some comparisons available (not commercial Embarcadero ones) https://db-engines.com/en/system/Firebird%3BInterbase or you can read https://ib-aid.com/en/articles/differences-between-firebird-and-interbase/ vs https://www.embarcadero.com/fr/products/interbase/compare/interbase_firebird And make a choice Well I do that years ago and had no problem with
  8. Serge_G

    Interbase - Update & Select

    Well, with Firebird it is, using variable context (old way). I do not remember if Interbase had this capacity (guess yes) P.S. By the way, what is your Interbase version ? SELECT CUSTNO, rdb$get_context('USER_TRANSACTION', 'row#') as LINENO, rdb$set_context('USER_TRANSACTION','row#', coalesce(cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer), 0) + 1), ITEMNO, PRICE FROM table-1 ORDER BY CUSTNO But you need to add some context variable to check and reset to 1 when changing of CUSTNO New ways - Recursive Common Table Expression (I will not expand because best way is below) - Windows function SELECT CUSTNO, ROW_NUMBER() OVER (partition by CUSTNO) LINENO, ITEM, PRICE FROM TABLE_1 ORDER BY CUSTNO I suggest you to search in Interbase (version ?) documentation with these two terms By the way, I suggest you a best way to ask a SQL question : add a script CREATE TABLE table_1 ( CUSTNO INTEGER NOT NULL, ITEM CHAR(2), PRICE NUMERIC(10,2) ); INSERT INTO TABLE_1 VALUES (1,'AA',100); INSERT INTO TABLE_1 VALUES (1,'BB',150); INSERT INTO TABLE_1 VALUES (2,'AA',100); INSERT INTO TABLE_1 VALUES (2,'CC',200); INSERT INTO TABLE_1 (CUSTNO, ITEM, PRICE) VALUES ('3', 'BB', '150.00'); INSERT INTO TABLE_1 (CUSTNO, ITEM, PRICE) VALUES ('3', 'AA', '100.00'); INSERT INTO TABLE_1 (CUSTNO, ITEM, PRICE) VALUES ('3', 'CC', '200.00'); and then the expected result (ok, here I cheat it's the result of the windows function SQL using the data I used
  9. Serge_G

    Interbase Update

    What if you use a trigger BEFOREUPDATE on table Master ?
  10. Serge_G

    TListView OnItemClick problems

    I don't have any Apple devices but on Androïd OnItemClick works fine. for IOS : what about onTap or Gesture management
  11. Serge_G

    Vcl to Fmx

    My preference goes to Grid rather than StringGrid, but I prefer a ListView Agree sjordi, VCL components are poor if you compare. i.e a VCL app use Tpanel, a FMX app will use Layout or TRectangle
  12. Serge_G

    TListView first and last item visible

    IMHO if your listview only have items not resized you can use ScrollViewPos property and perhaps the ScrollViewChange event var first, last : integer; begin first:=Trunc(listview1.ScrollViewPos/listview1.ItemAppearance.ItemHeight); Last:=First+Trunc(ListView1.Height/listview1.ItemAppearance.ItemHeight); memo1.lines.add(Format('First %d Last %d',[first,last])); If you have a TSearchbox visible I think it's easy to take care of it (using Searchbox unit to get the height) If you have groups or variable height items this should be harder but still using ScrollViewPos I think it's playable, you "just" have to calc from top, cumulate all items height till reaching ScrollViewPos for first and ScrollViewPos+ListView.Height for last
  13. Serge_G

    TListView Paging

    Hi, Well, logic, yes. Depending on the REST API server function. On another side a TListview (livebinded) for only 10 records a VerticalScrollbox filled by code should be a good alternative, IMO getting previous page and next page (30 records) during thread process should be better
  14. Serge_G

    FMX TListView with dynamicappearance. Create progress bar as bitmap.

    Hi Sorry but, I think we don't play in the same playground. For me, a TListView is used with Livebindings to fill it with data coming from a data source (table, query or list of Object). You use it like a TListBox! With a TListBox it's easy to put in a style whatever you want (in this case a text and a progress bar). By the way, your code is more for this kind of component, Create a style (layout, ttext, progressbar) just to adapt your code in the "for FR in FArray do" loop set the style of the created item item.stylelookup:='mystyleprogress' insert an item.applystylelookup change access to the objects of the item
  15. Serge_G

    FMX TListView with dynamicappearance. Create progress bar as bitmap.

    Hi, if you mean something like this (my first try) I use this code unit UnitProgess; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.ListView.Types, FMX.ListView.Appearances, FMX.ListView.Adapters.Base, Data.Bind.GenData, System.Rtti, System.Bindings.Outputs, FMX.Bind.Editors, Data.Bind.EngExt, FMX.Bind.DBEngExt, Data.Bind.Components, Data.Bind.ObjectScope, FMX.ListView, Fmx.Bind.GenData; type TForm18 = class(TForm) ListView1: TListView; PrototypeBindSource1: TPrototypeBindSource; BindingsList1: TBindingsList; LinkListControlToField1: TLinkListControlToField; procedure ListView1UpdateObjects(const Sender: TObject; const AItem: TListViewItem); private { D├ęclarations priv├ęes } public { D├ęclarations publiques } end; var Form18: TForm18; implementation {$R *.fmx} procedure TForm18.ListView1UpdateObjects(const Sender: TObject; const AItem: TListViewItem); var pBitMap: TBitmap; // for further purpose pListItemImage : TListItemImage; begin if AItem.Purpose = TListItemPurpose.None then begin pListItemImage:=AItem.Objects.FindObjectT<TListItemImage>('ProgressBar'); if assigned(pListItemImage) then begin pListItemImage.Bitmap.Width:=400-(abs(PrototypeBindSource1.DataGenerator.FindField('intfield1').GetTValue.AsInteger)*10); pListItemImage.Bitmap.Clear(Talphacolors.RED); end; end; end. Quick designed But I shall investigate more because this "version" need a link to (bitmap1 -> Item.ProgressBar) I was enabled to add a bitmap directly (PlistItemImage is unassigned if there is no link)