Jump to content

Lajos Juhász

Members
  • Content Count

    1063
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by Lajos Juhász

  1. Lajos Juhász

    Re-Index a PageControl.PageIndex

    If you have invisible tabsheets you cannot write anymore: XTabSheet:=PC1.Pages[TabIndex]; You've to find in a pages the index that contains the TabSheet with Tabindex. Something like this: procedure TMainForm.PC1DrawTab(Control: TCustomTabControl; TabIndex: Integer; const Rect: TRect; Active: Boolean); var XTabSheet: TTabSheet; XRect: TRect; FormColor: String; lpc: TPageControl; i: integer; begin if Active then begin Control.Canvas.Brush.Color:=$006ED7FC; Control.Canvas.Font.Color:=clBlack; end else begin FormColor :=dm.SettingsFormColor.AsString; if MatchText(FormColor,['Windows','Gray']) then Control.Canvas.Brush.Color:=$003C3838 else if MatchText(FormColor,['Brown','Light Brown']) then Control.Canvas.Brush.Color:=$0034527E; ...... end; XRect:=Rect; Control.Canvas.FillRect(XRect); //XTabSheet:=PC1.Pages[TabIndex]; lpc:=Control as Tpagecontrol; XTabSheet:=nil; i:=0; while (XTabSheet=nil) and (i<lpc.PageCount) do begin if lpc.pages[i].TabIndex=TabIndex then XTabSheet:=lpc.pages[i]; inc(i); end; DrawText(Control.Canvas.Handle, PChar(XTabSheet.Caption), length(XTabSheet.Caption), XRect, DT_VCENTER + DT_SINGLELINE + DT_CENTER); end;
  2. Lajos Juhász

    Splitting component suite = strange internal error

    I fought a similar problem couple of years ago. In that case for reason that the package contained too much "something" that Windows or Delphi was unable to handle after moving to newer version of Delphi. The solution was to break the package into two.
  3. Lajos Juhász

    How are you handling SVG images?

    You can also try https://github.com/EtheaDev/SVGIconImageList
  4. Lajos Juhász

    Locate

    This is a bad idea for two reasons: 1.) What will happen when the value is null? It will fail with message that Delphi cannot convert the null to string. 2.) Why would you like to find the field for every record. You should find it before wile and store it in a local variable and use that instead.
  5. Lajos Juhász

    About TGUID type...

    Why is it annoying? TGUID is not a string. You can write your function as: function GenerateAppGUID: TGuid; begin Result := StringToGUID('{481E85E5-3874-4FCB-BEA1-B65D640AE6D3}'); end;
  6. Lajos Juhász

    Splitting component suite = strange internal error

    Instead of adding the units from the runtime package into the design time you should add the runtime package as required. (The 32 bit version of the runtime package must inside the path).
  7. Lajos Juhász

    How to use unit BufferedFileStream & FastCopy?

    Define too expensive. (WD Purple 3,5" 1TB costs about 47.58€ and it's only at 5400 RPM, the faster WD Black 3,5" 1TB costs 77,41€. For SSD we can take for example Samsung 870 QVO 1TB SSD (MZ-77Q1T0BW, SATA 6 Gb/s) costs 106.09€ for me it's not a huge difference.)
  8. Lajos Juhász

    How to use unit BufferedFileStream & FastCopy?

    HDD is so old. All the new fancy kids are using SSD.
  9. Lajos Juhász

    Drawing problem with TStatusBar

    I get the problem only in design time. At run time it shows ok in the empty project.
  10. Lajos Juhász

    DBGrid DrawColumnCell

    It's not an error, it's how you've coded to create a new button in every paint event. Instead of that I would use the inbuild feature of the dbgrid. On you column set ButtonStyle to cbsEllipsis then you can place your in the OnEditButtonClick event of the grid.
  11. Lajos Juhász

    upcoming language enhancements?

    It's not obsolete I received as the answer from Embarcadero a couple of months ago when asked on a webinar. They feel there is no need to inform us ahead. I wonder do they actually have a plan what they would like to deliver in Delphi 11?
  12. Lajos Juhász

    Bug with formatfloat in crossplatform ?

    The default should be populated with the values that are supplied by the OS - http://docwiki.embarcadero.com/Libraries/Sydney/en/System.SysUtils.TFormatSettings.Create
  13. Lajos Juhász

    Sql

    I don't have Interbase. It's impossible that "GROUP BY M.LMONTH" can produce this result. The only way you can get this if you left TName inside group by.
  14. Lajos Juhász

    Sql

    I cannot test this but should be: select M.LMoth, sum(Case When I.TNAME='Sell' then I.TOTAL else 0 end) as TOTALSELL , sum(Case When I.TNAME='Buy' then I.TOTAL else 0 end) as TOTALBUY FROM INVOICE I JOIN MONTHS M ON M.SMONTH=I.SMONTH WHERE CUSTNO=20 GROUP BY M.LMONTH
  15. Lajos Juhász

    Floating point arithmetics

    My first guess is that you're comparing the result of a 32 bit and 64 bit applications. In 64 bit Extened = Double.
  16. Lajos Juhász

    converting string to date time

    var ldt: TDateTime; lFormat: TFormatSettings; begin lFormat:= TFormatSettings.Create; lformat.DateSeparator:='-'; lformat.ShortDateFormat:='yyyy-mm-dd'; ldt:=strtodatetime('2021-06-25 08:04:09', lFormat); ShowMessage(DateTimeToStr(ldt)); end;
  17. Lajos Juhász

    TJSONObject.Format bug

    A quick find in files returned that TJSon is implemented in the REST.Json.pas and it is not in your uses.
  18. You should learn to use the help. aStatusBar.SimpleText := 'selected cell -> ' + strngrd_Point3D.Row.ToString + '/' + strngrd_Point3D.Col.ToString;
  19. Lajos Juhász

    Disable & re-Enable a Procedure

    But you references the object as dm.Orders.Docno with dm that would suggest that it was from outside. In this case it should be: OrdersDOCNO.OnChange := nil; OrdersDOCNO.OnChange := OrdersDOCNOChange;
  20. Lajos Juhász

    Disable & re-Enable a Procedure

    OrdersDOCNOChange is part of the datamodul: dm.Orders.DOCNO.OnChange := dm.OrdersDOCNOChange;
  21. Lajos Juhász

    Alfabetical order of a letter

    ord('C')-ord('A')+1, ORD('E')-ORD('A')+1, ...
  22. Lajos Juhász

    SQL expression evaluation not supported

    Most probably the problem is the group by part. You've there O.Delvdate that is not in the select list. Interbase 2017 Update 1 (http://docwiki.embarcadero.com/InterBase/2020/en/Enhancements_to_GROUP_BY_and_ORDER_BY) introduced the extended syntax. If you're using a version that support you can write: SELECT O.DELVTYPE, SUM(OD.REMAINQTY) QTY, (Case O.DELVTYPE When 'Sea' then O.DELVDATE + 45 else O.DELVDATE + 15 end) as DELVDATE FROM ORDETAIL OD JOIN ORDERS O ON O.RNO=OD.RNO WHERE OD.ITEMNO = 'ABX22' GROUP BY O.DELVTYPE, 3 HAVING SUM(OD.REMAINQTY) > 0
  23. Lajos Juhász

    Delphi compatibility with Windows 11?

    I wonder how hard it will be to turn on UEFI on a laptop.
  24. Lajos Juhász

    What is the difference??

    The first one will create TMyForm instance with no owner. While the second one creates an instance of TMyForm owned by the application object. In case the form is the first form created by the application it will make it the mainform of the application. For more detail open VCL.Forms.
  25. There is no data type TxQuery it's TxQuery<T: TDataset>. Unfortunately in Delphi you cannot have a class reference to a generic class. I've even tried this: type TFDxQuery = TxQuery<TFDQuery>; TxFDQueryClass = class of TFDxQuery ; an it also fails with [dcc32 Error] Unit1.pas(43): E2021 Class type required I would expect that TFDxQuery is a class.
×