Jump to content

Serge_G

Members
  • Content Count

    315
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Serge_G

  1. 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
  2. Serge_G

    FastReport - Check printing

    Hi, use paragraphgap, linespacing, wordwarp and wordbreak properties (as I answered on french delphi forum ) Serge aka SergioMaster
  3. 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;
  4. 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
  5. Serge_G

    Listview Programming

    So I suggest you to use Frames and a ScrollBox (or VertScrollBox or HorzScrollBox) Here my "french" way to do it. But I remember also a some videos of CodeRage 2019 #13
  6. Serge_G

    Listview Programming

    Hi, 2 solutions. First one is to use a TListView and Dynamic appearance, like this (listview "livebinded" to fdmemtable) In this case, it could be easy to manage groups. pro : if data is in a Table, it's easy to fill with livebindings and easy to manage groups con : if you want different size (possible) you have to code Second one is to use a TScollbox and a TFrame (same design as Item). pro : It's easy to resize a TFrame. In this case, Headergroup should certainly be another frame. con : All is to code Depending of solution you choose, I will explain more if needed
  7. I don't think soundex to be a good algorithm, I certainly look for phonetic
  8. Hi, No, this new TSpinBox should use the same style. Except if you put this style in the default collection. As I remember when style is to be applied, "delphi" look for platform style and then default style if stylelookup is not found. Ah, this should be a possibility Another solution is to change the style of the component during runtime (I found this trick some month ago, but I don't remember where I save this one) [EDIT] Finally, found. If you read French it's in my blog I explain 2 methods, I think second one "modify the style directly" could apply. If you can screenshot what you expect I will take this like a challenge 😉
  9. Serge_G

    delete record

    Really ! I don't think this use of recnum is serious. Why don't you use something like if FDConnection.ExecSQL('DELETE FROM mytable where Key=:K',[sysp^.key ])>0 then showmessage('record(s) deleted'); Even if I am not sure of this sysp^.key have the good value 😲 expect yes, but this should be tested by debug
  10. Serge_G

    NetHTTPRequest PUT and api

    Perhaps some tips here Developer Skill Print
  11. Serge_G

    How can i display skew t and hodograph plots

    You can use Python4Delphi
  12. Thanks, but this AFRO thing is now obsolete because IDE force it when you close designer (ouf)
  13. You declare a TListbox not a TListView so it's normal, units for Tlistview ( FMX.TlistView,FMX.TlistView.xxxx) are not declared works with a TlistView A list box (simple one without style) should be filled with Listbox1.Items.Add('Hello') other way is to declare a TListboxItem var aItem : TlistboxItem; begin aItem:=TlistboxItem.Create(Self); aItem.Parent:=ListBox1; aItem.Text:='Hello'; end; P.S. If you want to involve style, here is a tutorial I wrote (long time ago, XE4, when TListview does not exists) Intro to styles Firemonkey XE4 (sorry in French)
  14. Serge_G

    FMX and Excel application

    Or you can use Firedac CDATA Excel
  15. Serge_G

    Missing CommandText property

    Hi, Generally, I use this syntax tbAddUser.Insert; tbAddUser.FieldByName('JM_User').asString := userstring; tbAddUser.FieldByName('OldValue').asString := DBEdit23.Text; tbAddUser.Post;
  16. Serge_G

    FB-3 Create a New Table

    There are no Firebird command for this. But you are in a Delphi forum, so my response should be :"Use FDBatchmove "
  17. Serge_G

    Where are my styles?

    Set UseStyleManager to true of StyleBook to avoid this. Note : Only one TStyleBook can be set. for exemple : put a Tpath and a panel on a form, fill the tpath with some data and set stylename to i.e. 'mytpath' now set panel.stylelookup to 'mytpath' and you will have your response Ok, but did you pay attention to platform ? Have a look at platform 'default' and others if any in stylebook.styles collection Ho ! You surely miss it because it's in "binary format" object StyleBook1: TStyleBook Styles = < item ResourcesBin = { 464D585F5354594C4520322E350106125370656564427574746F6E315374796C 653103EA13005450463007544C61796F757400095374796C654E616D65061253... } end item Platform = 'Windows 10 Desktop' ResourcesBin = { 464D585F5354594C4520322E3501060D427574746F6E315374796C6531039B0F 005450463007544C61796F757400095374796C654E616D65060D427574746F6E
  18. Serge_G

    FB-3 Delete

    Agree with @Stano. Read the manuals https://firebirdsql.org/file/documentation/html/en/refdocs/fblangref30/firebird-30-language-reference.html#fblangref30-dml-delete Have a look at global syntax of Delete it does not support jointures (noted as [<joins>] in a SELECT clause). You have to use a subquery DELETE FROM ORDETAIL OD WHERE OD.REMAINQTY = 0 AND Not Exists (SELECT 1 FOM ORDERS WHERE ID = OD.ID and INVDOCNO IS NOT NULL )
  19. Serge_G

    Function with 2 return values ?

    Hi, only a single result but you can change to function GetBomCosts(const ItemCode : String; var value1, value2 : Double) : boolean begin with TFDQuery.Create do begin Value1:=0; value2:=0; Connection:= FDConnection1; SQL.Text:='SELECT itemcode,value1,value2 from table where code='+quotedstr(itemcode); active:=true; if fieldbyname('Itemcode').isNull then result:=false else begin value1:=FieldByName('value1').asFloat; value2:=FieldByName('value2').asFloat; result:=true; end; active:=false; end; end;
  20. Serge_G

    FB3 Update

    Why do I ask for table description because I was thinking about a ACCOUNT,YEAR key or worst Why did you use 2 "embedded" SELECT when only one is needed ? So I suggest you to write and test this for first one ALTER PROCEDURE UPDATEACC_SINGLE ( ACCCODE VARCHAR(20), ACTIVEYEAR VARCHAR(4) ) AS DECLARE VARIABLE ACCREDIT NUMERIC(15,2); DECLARE VARIABLE ACDEBIT NUMERIC(15,2); BEGIN IF (ACCCODE IS NULL) THEN EXIT; SELECT SUM(AD.DEBIT),SUM(AD.CREDIT) FROM ACCRECDETAIL AD JOIN ACCRECEIPT AR ON AD.RNO=AR.RNO WHERE AD.ACCCODE=:ACCCODE and EXTRACT(YEAR FROM AR.TDATE)=:ACTIVEYEAR) INTO :ACDEBIT,:ACCREDIT; UPDATE ACCACCOUNT SET DEBIT=:ACDEBIT,CREDIT=:ACCREDIT WHERE ACCCODE=:ACCCODE END And second one /* For all records update s.proc */ ALTER PROCEDURE UPDATEACC_ALL ( ACTIVEYEAR VARCHAR(4) ) AS DECLARE VARIABLE ACCOUNT VARCHAR(20); DECLARE VARIABLE ACCREDIT NUMERIC (15,2); DECLARE VARIABLE ACDEBIT NUMERIC (15,2); begin FOR SELECT ACCCODE, SUM(AD.DEBIT),SUM(AD.CREDIT) FROM ACCRECDETAIL AD JOIN ACCRECEIPT AR ON AR.RNO=AD.RNO WHERE EXTRACT(YEAR FROM AR.TDATE)=:ACTIVEYEAR GROUP BY ACCCODE INTO :ACCOUNT,:ACDEBIT,:ACCREDIT DO UPDATE ACCACCOUNT SET DEBIT=:DEBIT, CREDIT=:AMOUNT WHERE ACCCODE=:ACCOUNT; end Note : you have to adjust VARIABLE declaration to your need of course
  21. Serge_G

    FB3 Update

    Hi, for me the 2 updates lack of a WHERE clause, but it depend on ACCACCOUNT table description
  22. Serge_G

    Fastreport

    I should say it's a problem of dataset(s). For me, your fastreport design is not good. In my mind you have to rework your datasets but this mean you have to give us more information than 2 screenshots ie. involved tables structure By the way : 1 - you have a french forum for this https://www.developpez.net/forums/f1771/logiciels/solutions-d-entreprise/business-intelligence/autres-outils-decisionnels/fastreport/ 2- your question need a cystalball !
  23. Serge_G

    Delphi10.3 - FB3 - Firedac BackUp

    Are you sure I wrote "normal" ? Oh! I see my "yes" was not for size (abnormal for me ) but for the "if there are users connected ("warmbackup ")" sorry for mistyping, when I quoted the second part about size, something happened and I was thinking No it's abnormal
  24. Serge_G

    Split String

    @Fr0sT.Brutal, code was edited during your post. Just a thing, this MyCode = 600.005.0010 then requested result = 600.005.0011 should not work you have to manage a way to have the good formatstring something like procedure TForm23.Button1Click(Sender: TObject); var S : TArray<String>; fmt : string; begin S:=Edit3.Text.Split(['.']); fmt:='%.'+Length(S[Length(S)-1]).tostring+'d'; S[length(S)-1]:=Format(fmt,[(StrToInt(S[Length(S)-1])+1)]); Edit3.Text:=String.Join('.',S); end;
  25. Serge_G

    Split String

    Hi, yes you can Split procedure TForm23.Button1Click(Sender: TObject); var S : TArray<String>; begin S:=Edit3.Text.Split(['.']); S[length(S)-1]:=Format('%.3d',[(StrToInt(S[Length(S)-1])+1)]); Edit3.Text:=String.Join('.',S); end;
×