Jump to content

Serge_G

Members
  • Content Count

    18
  • Joined

  • Last visited

Community Reputation

8 Neutral

About Serge_G

  • Birthday 06/29/1956

Recent Profile Visitors

49 profile views
  1. Serge_G

    Livebinded Lists and FillBreakGroups collection

    You have one linked to my blog post. To see the behavior that I denounce, you only have to use livebindings editor and synchronize,accepting link change, and renaming this new link (not fair hu ?) On the other hand, i am working on another sample (using the well-known biolife.cds) but it is not ready yet, mainly because i have some other functionalities (i.e. custom search) Here some screenshots (capture and capture_1 without synchronization, last one with synchronization) , same code procedure TMainForm.rdbListBoxChange(Sender: TObject); var AFillBreakGroup : TFillBreakGroupItem; begin LinkListBoxGroup.Active:=False; if TRadioButton(Sender).IsChecked then begin case TRadioButton(Sender).tag of 0 : begin LinkListBoxGroup.FillBreakGroups.Clear; LinkListBoxGroup.FillBreakFieldName:=''; LinkListBoxGroup.FillHeaderFieldName:=''; ClientDataSet1.IndexFieldNames:=''; end; 1 : begin LinkListBoxGroup.FillBreakGroups.Clear; LinkListBoxGroup.FillBreakFieldName:='Category'; LinkListBoxGroup.FillHeaderFieldName:='Category'; ClientDataSet1.IndexFieldNames:='Category'; end; 2 : begin ClientDataSet1.IndexFieldNames:='Length (cm)'; LinkListBoxGroup.FillBreakFieldName:='Length (cm)'; LinkListBoxGroup.FillHeaderFieldName:=''; // créer les groupes aFillBreakGroup:=LinkListBoxGroup.FillBreakGroups.AddItem; AFillBreakGroup.MinValue:='0'; AFillBreakGroup.MaxValue:=30.ToString; AFillBreakGroup.DisplayText:='Petits'; aFillBreakGroup:=LinkListBoxGroup.FillBreakGroups.AddItem; AFillBreakGroup.MinValue:=30.ToString; AFillBreakGroup.MaxValue:=60.toString; AFillBreakGroup.DisplayText:='Moyens'; aFillBreakGroup:=LinkListBoxGroup.FillBreakGroups.AddItem; AFillBreakGroup.MinValue:=60.ToString; AFillBreakGroup.MaxValue:=90.ToString; AFillBreakGroup.DisplayText:='Gros'; aFillBreakGroup:=LinkListBoxGroup.FillBreakGroups.AddItem; AFillBreakGroup.MinValue:=90.ToString; AFillBreakGroup.DisplayText:='Enormes'; end; end; end; LinkListBoxGroup.Active:=True; end;
  2. Hi, Pushing limits of TListBox and TListView I am testing FillBreakGroups collection (you can see my firsts steps here). Ok, that works fine was my first thoughts. Writing a new tutorial about list and livebindings, I create a new project and saw that using synchronize link and FillBreakGroups does not work is this not supposed to or is this a bug ? note : my tests are only on 10.3.2 version
  3. Serge_G

    Right To Left Components

  4. Serge_G

    InterBase or Firebird?

    If you only check for those 2 alternatives and only windows target my heart say Firebird as Dany Marmur I had no problem with since first version. if you want some encrypted column the choice is Interbase (native column encryption). Now if your targets are multi os, till now i don't access directly to Firebird database (client/server) on Android with Firedac but it works with IBDac. I don't test an embedded version of the database though. So for multi-os I certainly will choose IB keeping in mind Firebird . But if your project is not a multi-user one i vote for SQLite avoiding all database server deployment
  5. Serge_G

    Right To Left Components

    What about using TTextService ? I just had a (deep) look into Delphi source and found TTextServiceAndroid.DrawSingleLine {$IFDEF ANDROID} if SupportsPlatformService(IFMXTextService,aService) then begin alignement:=CheckRtl(Value.ToString,''); if alignement=TTextAlign.Trailing then flag := [TFillTextFlag.RightToLeft] else flag:=[]; // had to get font aService.DrawSingleLine(Canvas,Value.ToString,Bounds,Afont, 1,flag, alignement); end; {$ENDIF} My only problem is to get the right font though (the one in the style i presume). I don't go further with this for now..
  6. Serge_G

    Right To Left Components

    Oh, it seem that was the TTextLayout.RighttoLeft who do the trick but did not work for Android 😣 and I do not know if it works for those Apple things My friend Nabil just send me an intyeresting link
  7. Serge_G

    Right To Left Components

    Hi, I don't write nor read RTL languages, I wrote a function to detect if the text starts with a RTL char function checkRtl (S : string; Exceptions : String = '' ) : TTextAlign; var carray : array of WideChar; i : int64; ws : String; begin for I := 0 to 9 do S:=StringReplace(S,i.ToString,'',[rfReplaceAll]); // supprime autres caractères spéciaux S:=StringReplace(S,'(','',[rfReplaceAll]); S:=StringReplace(S,')','',[rfReplaceAll]); S:=StringReplace(S,'"','',[rfReplaceAll]); S:=StringReplace(S,'''','',[rfReplaceAll]); S:=StringReplace(S,'-','',[rfReplaceAll]); if not E.IsEmpty then begin for I := 1 to Length(Exceptions) do S:=StringReplace(S,Exceptions[i],'',[rfReplaceAll]); end; S:=Trim(S); // arabic + hebrew SetLength(carray,$6ff-$590); for I := $590 to $6ff do carray[i-$590]:=Char(I); // there are some farsi char to be added result:=TTextAlign.Trailing; if S.IsEmpty then exit; if inOpArray(S[1],carray) then result:=TTextAlign.Leading; end; And, with Nabil's Help I test my ideas in a grid. You can find (french) discussion here and my tutorial https://serge-girard.developpez.com/tutoriels/Delphi/Livebindings/Grilles/#LVII-C-1 I did not test for TEdit and TLabel though but my guess it is possible
  8. Serge_G

    TListView multi selection?

    Fool I am with this unnecessary interface ! In fact, it does exists yet. So here is my steps with a TListView / DynamicAppearance without passing it in Edit mode There for write the OnItemClickEvent (here my DynamicAppearance contains an TlistItemImage named 'Image' here is dfm part object YourListView: TListView ItemAppearanceClassName = 'TDynamicAppearance' ItemEditAppearanceClassName = 'TDynamicAppearance' HeaderAppearanceClassName = 'TListHeaderObjects' FooterAppearanceClassName = 'TListHeaderObjects' Position.X = 32.000000000000000000 Position.Y = 360.000000000000000000 Size.Width = 225.000000000000000000 Size.Height = 265.000000000000000000 Size.PlatformDefault = False TabOrder = 5 ItemAppearanceObjects.ItemObjects.ObjectsCollection = < item AppearanceObjectName = 'Image' AppearanceClassName = 'TImageObjectAppearance' Appearance.ScalingMode = Stretch end item AppearanceObjectName = 'Text1' AppearanceClassName = 'TTextObjectAppearance' end> ItemAppearanceObjects.ItemEditObjects.ObjectsCollection = < item AppearanceObjectName = 'Text1' AppearanceClassName = 'TTextObjectAppearance' end> OnItemClick = YourListViewItemClick end and code part var AListItemBitmap : TListItemImage; AListItemText : TListItemText; AColor : TAlphaColor; begin YourListView.Items.SetChecked(AItem.Index,not Aitem.Checked); AListItemBitmap:=AItem.Objects.FindObjectT<TListItemImage>('Image'); if Assigned(AListItemBitmap) then begin AListItemBitmap.OwnsBitmap:=True; AListItemBitmap.Bitmap:=TBitmap.Create(40,40); if AItem.Checked then AColor:=TAlphaColorRec.AliceBlue else AColor:=TAlphaColorRec.Null; AListItemBitmap.Bitmap.Clear(Acolor); end; but you can change text font (afraid AListItemText.TextColor don't work) AListItemText:=AItem.Objects.FindObjectT<TListItemText>('Text1'); if Assigned(AListItemText) then if AItem.Checked then AListItemText.Font.Style:=[TFontStyle.fsBold] else AListItemText.Font.Style:=[];
  9. Serge_G

    TListView multi selection?

    Well you can skip or hide , putting the listview in edit mode and hiding the checkbox works "as expected". I put commas in reference to my previous post. Using a Dynamic appearance this is the best way because checkbox doesn't react (point 2, bug ?) But color change the only thing is to find how the color is changing and set-it Well, if you have a Boolean field to bind, yes (I am writing another tutorial about Listview and ListImage but in review/correction till now). I checked for event like "OnChecked" or similar but for now I don't found one reachable, I searched in Interface IListViewCheckProvider and IListViewPresentation but without good result. I am looking for the checkbox drawing in the source but it's a little hard to track ! The more I check for selection the more I think there is a bug there but, "scalded cat fears cold water", I don't want to report to Bug Tracker (2 last one I report was said to be yet reported and one not reproducible) without any proof/solution I also work on an interface IListViewSelectedItems = interface ['{3D8B9910-A017-4A10-8260-D44E9F7129B7}'] procedure StartSelection; procedure SetSelected(Value : TList<Integer>); function GetSelected : TList<Integer>; property Selected : TList<Integer> read GetSelected write SetSelected; end; TListView = class(FMX.ListView.TListView,IListViewSelectedItems) private FSelected : TList<Integer>; public constructor Create(AOwner : TObject); // <<<<<<<<<<<< destructor Destroy; override; procedure StartSelection; procedure SetSelected(Value : TList<Integer>); function GetSelected : TList<Integer>; property Selected : TList<Integer> read GetSelected write SetSelected; end; { TListView override} procedure TListView.StartSelection; begin if not Assigned(FSelected) then FSelected:=TList<Integer>.Create; end; function TListView.GetSelected : TList<Integer>; begin result := FSelected; end; procedure TlistView.SetSelected(value : TList<Integer>); begin FSelected:=Value; end; Here I can surely add an OnSelect event,(optionally a ClearSelection, SelectAll procedure). But I am still blocked 1 - a way to initialize FSelected at creation time (without using StartSelection) 2 -on painting selection (overriding or duplicating IListViewCheckProvider ?)
  10. Serge_G

    LiveBinding at runtime

    Hi, sorry for delay but if it is still in actuality here is how i make this with TBindGridLink.Create(Self) do begin ControlComponent := Grid1; SourceComponent := AdapterBindSource1; // Filling Grid ColumnExpressions.AddExpression; // adding a right filler with ColumnExpressions.AddExpression do // ColumnName = 'Code', ColumnIndex = 1 begin SourceMemberName := 'Code'; with FormatCellExpressions.AddExpression do begin ControlExpression := 'Data'; SourceExpression := 'Value'; end; end; // an so on for columns // MANDATORY TO NAVIGATE // Position (synchronisation entre la liste et la grille) with PosControlExpressions.AddExpression do begin ControlExpression := 'Selected'; SourceExpression := 'Math_Max(0,ItemIndex)'; end; with PosSourceExpressions.AddExpression do begin ControlExpression := 'Math_Max(0,Selected)'; SourceExpression := 'ItemIndex'; end; // Working on columns size with FormatControlExpressions.AddExpression do begin ControlExpression := 'Columns[0].width'; SourceExpression := '20'; end; with FormatControlExpressions.AddExpression do begin ControlExpression := 'Columns[1].width'; SourceExpression := '140'; end; // and so on ... end;
  11. Serge_G

    Components for XADES and PDF signature

    Hi, Try TMS Cryptography pack Even if tagged as VCL it works for me in FMX environment. Well I don't use Xades but Pades so I should be pleased to know if it works also for Xades TMS offer also 2 free tools a certificate generator and a Ades document signature program done with the cryptography pack. Note, the team who wrote the component (Bernard Roussely and Marion Candau) is very reactive
  12. Serge_G

    TListView multi selection?

    😤 Well, I follow the track with those selections in edit mode, and I am disappointed ! 2 black points with the checkbox 1- with the common appearance (ListItemChecked, and all same type appearance). It works but if you don't want the checkbox checked when the item is clicked in theory you have to use option ClickOnSelect of TGlyphObjectButtonObject but this option as no effect (note was working with XE4) 2- I try to do the same thing but with appearance I prefer, the TDynamicAppearance one. In this case the checkbox don't react One question to @sjordi which event did you use for your selection, OnItemClick or OnItemClickEx ?
  13. Serge_G

    TListView multi selection?

    I knew I can find a better solution not involving bitmaps in the datasource . Here is the new code procedure TForm1.ListView1UpdatingObjects(const Sender: TObject; const AItem: TListViewItem; var AHandled: Boolean); var AListItemBitmap : TListItemImage; AListItemText : TListItemText; AColor : TAlphaColor; i : Word; begin AListItemBitmap:=AItem.Objects.FindObjectT<TListItemImage>('Image2'); AListItemText:=AItem.Objects.FindObjectT<TListItemText>('Text1'); if Assigned(AListItemBitmap) then begin AListItemBitmap.OwnsBitmap:=True; // this is the trick AListItemBitmap.Bitmap:=TBitmap.Create(40,40); try AColor:=StringToAlphaColor(AListItemText.Text) except // certaines couleurs sont inconnues! i.e. monneygreen, ltgrey AColor:=TAlphaColorRec.Null; end; AListItemBitmap.Bitmap.Clear(Acolor); //:=ABitmap; end; {$ENDIF} end; See line 12. Icing on the cake freeing bitmaps created is not needed anymore ! Tested on Windows10 and Android, hope it works on OSX and iOS
  14. Serge_G

    TListView multi selection?

    Even if this workaround works 👍, for me it's not satisfactory. I don't understand why this bitmap creation does not work on mobile devices !
  15. Serge_G

    TListView multi selection?

    Damned ! As far as I remember I test these codes with Berlin version but not for mobile devices. I investigate, (check my old hard disk to remember my various tests) and found the problem but no solution yet. I was right it as to do with bitmap ! But I cheat a little . I don't know which source you use, hope it's the color demo one. Cheating : I add a bitmap to my Tprotypebindsource . I link this one to the image object of the list, doing that we don't need to create (and destroy) bitmaps. Finally I change my code procedure TForm1.ListView1UpdatingObjects(const Sender: TObject; const AItem: TListViewItem; var AHandled: Boolean); var AListItemBitmap : TListItemImage; AListItemText : TListItemText; AColor : TAlphaColor; begin AListItemBitmap:=AItem.Objects.FindObjectT<TListItemImage>('Image2'); AListItemText:=AItem.Objects.FindObjectT<TListItemText>('Text1'); if Assigned(AListItemBitmap) then begin // AListItemBitmap.Bitmap:=TBitmap.Create(40,40); try AColor:=StringToAlphaColor(AListItemText.Text) except // certaines couleurs sont inconnues! i.e. monneygreen, ltgrey AColor:=TAlphaColorRec.Null; end; AListItemBitmap.Bitmap.Clear(AColor); end; end; Don't forget to remove the onCloseQuery event And, as you can see, image attached, it works ! After this "ascertainment", I dug in the developpez.net forum and found this post i wrote. The goal is now to mix the two but how ?
×