Jump to content

Lajos Juhász

Members
  • Content Count

    996
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by Lajos Juhász


  1. 1 hour ago, Rollo62 said:

    I wonder why Embarcadero is not offering an easy and stably native payment solution, or at least a valid tutorial howto get there.

     

    Mobile platforms are changing very fast. Sometimes it is difficult for Embarcadero to provde a solution in a reasonable time frame when the new requirements are released to be able to continue to compile for new versions. Unfortunately nowdays Delphi support too many platforms. They are playing catch up games against other products. Delphi is by rule almost always way behind.


  2. procedure TForm1.FormCreate(Sender: TObject);
    begin
     Var
        Boy: string;
        Girl: string;
        Couple: string;
    end;

    For those who doesn't have a modern compiler. Of course inline var is not a block thus it will produce errors:

     

    [dcc32 Error] Unit1.pas(29): E2003 Undeclared identifier: 'Girl'
    [dcc32 Error] Unit1.pas(29): E2029 '(' expected but ';' found
    [dcc32 Error] Unit1.pas(30): E2003 Undeclared identifier: 'Couple'
    [dcc32 Fatal Error] Project1.dpr(5): F2063 Could not compile used unit 'Unit1.pas'
    Failed

     

    • Thanks 1

  3. 10 minutes ago, Die Holländer said:

    I see in my version D12.2 that it is not installed as a default component.. 

    You have to select a checkbox during the install process (Technology - Teechart standard). Unfortunately Embarcadero has licenced the product without the source code.

     

    I did not noticed problems with the Teechart.


  4. Set the transparent property to false:

     

    var
      num: TStaticText;
    begin
     num:=TStaticText.create(self);
              num.parent:=self;
    //          rect:=wc.boundsrect;
    //          num.caption:=' '+inttostr(lastnumnum)+' ';
              num.caption:=' Test';
              num.font.name:='Arial';
              num.font.color:=clred;
              num.Transparent:=false;
    end;

    Edit. You have to use StyleElement only if your application is using VCL Styles.


  5. This was written by Copilot. I can not test the code as I do not have the iOS units installed on my system.

     

    To change the screen brightness on iOS using Delphi, you can use the UIScreen class from the iOS API. Here's a basic example of how you can achieve this:

    1. 
    Import the necessary iOS units:

    uses
    iOSapi.UIKit, iOSapi.Foundation;

    1. 
    Set the screen brightness:

    procedure SetScreenBrightness(Brightness: CGFloat);
    begin
    UIScreen.mainScreen.setBrightness(Brightness);
    end;

    1. 
    Call the procedure with the desired brightness level:

    begin
    SetScreenBrightness(0.5); // Set brightness to 50%
    end;

    In this example, UIScreen.mainScreen.setBrightness is used to set the brightness level. The brightness value should be between 0.0 (minimum brightness) and 1.0 (maximum brightness)https://www.reddit.com/r/iOSProgramming/comments/whtu5q/is_there_a_way_to_control_screen_brightness/https://forums.developer.apple.com/forums/thread/717234.

    Would you like more details on integrating this into a full application?

    • Thanks 1

  6. program Project1;
    
    {$APPTYPE CONSOLE}
    
    {$R *.res}
    
    uses
      System.Classes,
      Winapi.Windows;
    
    type
      TMyRecord = class
        data: Integer;
    
        class procedure Queue(const AThread: TThread; AMethod: TThreadProcedure);
      end;
    
    class procedure TMyRecord.Queue(const AThread: TThread; AMethod: TThreadProcedure);
    begin
      OutputDebugString(PChar('In TMyRecord.Queue'))
    end;
    
    begin
      TThread.Queue(nil, procedure begin OutputDebugString(PChar('Hello !')) end);
      TMyRecord.Queue(nil, procedure begin OutputDebugString(PChar('Hello !')) end);
    end.

    It should be TThreadProcedure not method.

    • Like 1

  7. 25 minutes ago, krayna said:

    Yes, I know this, but with Firebird it was no problem even if I didn´t set the data type before calling prepare. It´s a big project and I would have to change a lot of code for this. I just wondered why this was never an issue with Firebird and now it´s a problem with PostgreSQL.

     

    FireDAC is very strict. When I have moved projects from BDE and DBX that involved a lot of changes.


  8. You have some hidden unicode character there. It can happen if you copy paste from the internet.

     

    var
       FileName : String;
       attributes: TFileAttributes;
    begin
      FileName := 'Test';
    
      attributes:= TFile.GetAttributes(FileName);
    
      Include(attributes, TFileAttribute.faHidden);
      TFile.SetAttributes(FileName, attributes);
    end;

    This compiles.


  9. According to the documentation the object property of the stringlist is used to handle the shortcuts not the text version:
     

    TCustomShortCutList is a descendant of TStringList, which manages a collection of strings. As such, TCustomShortCutList adds, deletes, and searches for shortcuts using their text representation. TCustomShortCutList stores shortcuts that correspond to a text representations as values of the Objects property for these strings. Do not change values of the Objects property, or the shortcut list will not operate correctly.


  10. In the official documentation there is no mention that it would be a language specific shortcut:

     

    Description

    Stores shortcuts (in addition to ShortCut) for triggering the action.

    Actions can execute in response to multiple shortcut key combinations. SecondaryShortCuts lists all the shortcut key combinations (other than the one specified by the ShortCut property) that can trigger the action. This lets you provide additional, secondary shortcuts.

    When the user types one of the key combinations listed in SecondaryShortCuts, the action's Execute method is called.


  11. 8 minutes ago, ertank said:

    Delphi is giving problems on Windows 11 and identical (down to installed components) system on Windows 10 works just fine.

     

    In that case I am the unlucky one. Have had no issues using Delphi 12.2 update 1 on Windows 11.

    • Like 1
    • Haha 1

  12. 9 hours ago, Stefan Glienke said:

    Yes, pretty much - we all know they first ship a half-baked feature to generate marketing hype and then spend the next decade tinkering around the edges to make it work while representatives are telling us "eh, its complicated"

     

    I believed it is a different aproach. They give to us something that compiles and is working. Then based on user review and bug reports they are accepting suggestions how to make it work.  If everything else fail they buy some source code to make things working again.

    • Haha 1

  13. I have no problem to compile it:

     

    const
    // The highlight colors here are defined twice so the compiler doesn't complain.
      YELLOW = $00BBFF;
      BLUE = $F0CF89;
      HIGHLIGHT_COLORS: array[0..1] of TColor = (YELLOW, BLUE);

    You can also compile:

     

    const
    // The highlight colors here are defined twice so the compiler doesn't complain.
      YELLOW = TColor($00BBFF);
      BLUE = TColor($F0CF89);
      HIGHLIGHT_COLORS: array[0..1] of TColor = (YELLOW, BLUE);

     

×