Jump to content

Serge_G

Members
  • Content Count

    311
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Serge_G

  1. First question : Is this supposed to be a FMX or a VCL program ? If FMX you can write this app with "no code" (except itemclick to change from list to view and reverse) using Livebindings Here a french tuturial I wrote (2018)
  2. Serge_G

    Paradox 7 >>> Firebird 3 DATA transfer

    Yes, you have to change port in firebird conf for one of your Firebird version Here my w10 workstation with default FB3 and FB4 possibility. Very easy with FDBatchmove, but take care of the capacities of Firebird and optimize your table structure
  3. Serge_G

    IB -> FB Data Transfer

    No, no demo project, it's very easy to reproduce with only the picture as guideline. The connections and query parameters are too depending of your needs
  4. Serge_G

    [Android] How to put data from a dataset into a listbox?

    Why don't you use a TListView with dynamic appearance and Livebindings ?
  5. Serge_G

    Load image from splite blob field

    Hi, The simplest way (without checking errors) procedure loadbitmapfromblob(abitmap : TBitmap; aBlob : TField); var aStream : TMemoryStream; begin aStream:=TMemoryStream.Create; try TBlobField(aBlob).SaveToStream(aStream); // aStream.Position:=0; aBitmap.LoadFromStream(aStream); finally aStream.Free; end; end; usage loadbitmapfromblob(Image1.Bitmap,datamodule2.InsertImg.FieldByName('camarapic')); But can I suggest this ? (FMX program) or even using Livebindings for "no code" procedure loadImagefromblob(aImage: TImage; aBlob: TField); begin var aStream: TMemoryStream; begin if aBlob.IsNull then aImage.Visible := False else begin aStream := TMemoryStream.Create; try TBlobField(aBlob).SaveToStream(aStream); try aImage.Bitmap.LoadFromStream(aStream); aImage.Visible:=true; except aImage.Visible := False; end; finally aStream.Free; end; end; end; end; for VCL use this procedure, not forgetting to declare units Vcl.Imaging.jpeg and Vcl.Imaging.pngimage procedure TFormVCL.loadImage(aImage: Timage; aField: TField); var aStream : TmemoryStream; begin if aField.IsNull then aImage.Visible:=false else begin aStream:=TmemoryStream.Create; try TBlobField(aField).SaveToStream(aStream); aStream.Position:=0; AImage.Picture.LoadFromStream(aStream); aImage.Visible:=true; finally aStream.Free; end; end; end;
  6. Serge_G

    BindLinkFMXProject, where is the data?

    Sorry, I found file fishfacts.cds in <RadStudioDemos-Main> \Object Pascal\LiveBindings\common demo found here on GitHub
  7. Serge_G

    BindLinkFMXProject, where is the data?

    It's Livebindings. On your form you certainly have a TClientDataset (database name is now C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Data\biolife.cds) a TBindingList and a TBindSourceDB
  8. Serge_G

    search between two dates

    Il existe un très bon forum en français https://www.developpez.net/forums/f15/environnements-developpement/delphi/ (mon pseudo SergioMaster)
  9. Serge_G

    Good data grid for VCL and FMX

    Hi, perhaps TMSFNCGrid
  10. Serge_G

    search between two dates

    👍 programmerd2k response, and, with firedac, you can simplify his code to : procedure TForm1.Button1Click(Sender : TObject) begin Salestable.open('',[DateFrom.Date,Dateto.Date]); end;
  11. Serge_G

    FMX Default style in TStyleBook

    To respond to question point 8. There are one style for each platform because doing this you reduce size of the app. In your case, my usage is to create one data module per platform and using IFDEF$ clause on each data module a Stylebook corresponding to platform, all the Stylebook have UseStylemanager=true.
  12. Serge_G

    corrupt primary key?

    I was thinking this way, even if I don't know it could solve your problem
  13. Serge_G

    corrupt primary key?

    Using Charset NONE is a regrettable habit ! I still have some database with this default encoding and migration to best encoding is not so easy, no easy tool for this ! Try to use WIN1252 as fdconnexion charset
  14. Serge_G

    Mysql connection problem

    You need 32bit version for the IDE
  15. Il ne faut pas rêver, j'ai bien sûr conçu un logiciel de ce genre (magasin usine d'un fabricant de chaussures), mais, fournir les sources sans rémunération, comment je me paye la maintenance de Delphi ?
  16. Serge_G

    ExtendedMetadata and .AsInteger for small int column

    Since FB.3 boolean type exists https://firebirdsql.org/file/documentation/chunk/en/refdocs/fblangref30/fblangref30-datatypes-booleantypes.html
  17. Serge_G

    Custom TListBoxItem Live Bindings Advice

    Ah, ok, in this case TListBox (or a <Vert,Horz>ScrollBox with Frames) is the need. When XE4, ListView and dynamic appearance does not exist, as neophyte to styles I wrote my experience in this paper. I think this chapter will cover your needs
  18. Serge_G

    Custom TListBoxItem Live Bindings Advice

    Don't you think you can use FMX.Tlistview (dynamic appearance) instead of FMX.Tlistbox ? I wrote many (french) notes here or tutorials (here) about
  19. Serge_G

    How do I handle the 'closed dataset' error ?

    Sure, you can't catch the error if the error is in the upper code ! I think you use a wrong way. As I understand you have a FDQuery so one way is to use edit/post/delete and so on is to link it to a FDUpdateSQL (fill clauses with expert or by hand) with this method, you can use a "classic" qry.Insert; // or qry.append qry.FieldByName('col1').asString:='some string'; qry.fieldbyname('col2').as ... qry.post In a livebinded grid nothing to code Some remarks : - when you open a query (or a table) the connection is connected automatically - use your commands SQL directly on the connection and parameters con.ExecSQL('insert into tblBarcodes values (:i, :p1,:p2,:p3,:p4)', [6,'120422','Q','abc1','2 120422 Q abc1 desc1']); - use the INSERT INTO TABLE (<list of column>) VALUES (<list of values>) to avoid auto increment columns - except if you want a "physical" ordered table don't worry about APPEND
  20. I don't think this is a good one solution. You say it's a FMX project and I assume : - you use livebindings - con is your fdconnection You can do your delete via the FDConnection like this procedure TForm1.btnDelLastRowClick(Sender: TObject); var lastrowid : integer; begin Query1.last; lastrowid:=Query1.Fieldbyname('IDNO').asInteger; if lastrowid.isnull then exit; // if table is empty con.ExecSQL('delete from tblBarcodes where IDNo=:s',[lastRowValue]); query1.Open(); // or Query1.open('Select * from tblbarcodes'); end; now this code should show some flickering and have disadvantage to unselect the current row selected 😞 because of Query1.open 1- flickering can be avoided by BeginUpdate .. EndUpdate block 2- there are many ways to memorize current position in the dataset - using key, memorize in another variable the current idno and using var currentid : integer :=Query1.FieldbyName('IDNO').asInteger; // code for deleting Query1.Open(); Query1.Locate('IDNO',currentid,[]); not recommended if not mono user app - using recordno - using FDQuery.GetBookmark and FDQuery.GotoBookmark
  21. Serge_G

    TRichEdit equivalent in FMX?

    Perhaps this one https://www.trichview.com/ showed in getIt ?
  22. Serge_G

    TTextAlign problems in TEdit in FMX

    Hi, You need to give the type of the enumeration, use Edit1->TextSettings->HorzAlign =TTextAlign.Leading Edit1.TextSettings.HorzAlign :=TTextAlign.Leading It's only some ways to change. I use Delphi from D3 version, my new applications are all FMX, it took me 1-2 years to take the plunge, but now I much prefer FMX
  23. Serge_G

    FastReport - Check printing

    Hi, use paragraphgap, linespacing, wordwarp and wordbreak properties (as I answered on french delphi forum ) Serge aka SergioMaster
  24. Serge_G

    SQL problem

    Depends of SGBD I think, but if not it's possible to, use Firedac macros 1- This zip contains a SQLite database not a MySQL one as indicated first ! 2- The database contains a really poor lines for testing ! And nothing to do with directories Suggestion for Button2.OnClick uses System.IoUtils; procedure TForm1.Button2Click(Sender: TObject); var FileListe : TArray<String>; i: integer; begin FileListe:=TDirectory.GetFiles(Edit1.Text); for var s: String in FileListe do i:=i+FDQuery1.ExecSQL('INSERT INTO Files(maindirectory) Values (:s)',[S]); Showmessage(i.ToString+' records added'); end; Suggestion for Query procedure TForm1.Button1Click(Sender: TObject); begin FDQuery1.Close; FDQuery1.SQL.Text:='SELECT Maindirectory from files WHERE Maindirectory LIKE &S'; FDQuery1.MacroByName('S').AsRaw:=Quotedstr(Edit1.Text+'%'); FDQuery1.Open; end; As you can see, this also include ability to use macro char % in the like clause value so for MySQL INSTR function, you can set Edit1.Text to '%AEnvoyer' TAKE CARE of SQL Injection with macro usage Ah, yes 👍 so Button2.Onclick can be wrote on different ways procedure TForm1.Button1Click(Sender: TObject); begin // FDQuery1.Close; // By Macro Need FDQuery1.Close and FDQuery1.Open // FDQuery1.SQL.Text:='SELECT Maindirectory from files WHERE Maindirectory LIKE &S'; // FDQuery1.MacroByName('S').AsRaw:=Quotedstr(Edit1.Text+'%'); // By Parameter Need FDQuery1.Close and FDQuery1.Open // FDQuery1.SQL.Text:='SELECT Maindirectory from files WHERE Maindirectory LIKE :p'; // FDQuery1.ParamByName('P').AsString:=Edit1.Text+'%'; // FDQuery1.Open; // By Parameter No Need of FDQuery1.Close and FDQuery1.Open, my preference FDQuery1.Open('SELECT Maindirectory from files WHERE Maindirectory LIKE :p', [Edit1.Text+'%']) ; end;
  25. Serge_G

    Listview Programming

    When I use ScrollBox and Frames, I never use anchors, preferring to calculate positions of each frame. Why ? I remember a video of a Brazilian guy demonstrating that this way was minus time-consuming
×