Jump to content

shineworld

Members
  • Content Count

    283
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by shineworld


  1. Hi all,

     

    I'm using Sydney 10.4.1 and I'm used to works with ProjectGroups formed by 8-12 projects.

    A project could have only WIN32 version and other have either WIN32 and WIN64 versions.

    A WIN32 build outputs an exe as <project_name>.32.exe.
    A WIN64 build outputs an exe as <project_name>.64.exe

    There is a way to say to IDE: Build all projects versions (Win32 or Win32/Win64 when projects have either) in a single click?
    At this moment I need to continue to switch manually the active Target Platform from WIN32 to WIN64 and it is a great waste of time.

    Thank you in advance for your replies.

     


  2. I'm using a cleaned gnugettext version from dxgettext-code-r131-trunk in sourceforge:

    https://sourceforge.net/p/dxgettext/code/HEAD/tree/

     

    - I'm using an update manager in EXE so when the update copies the new locale.mo files from the server they are named locale.mo_NEW.

      This is because you can't overwrite a loaded locale.po when EXE is running, so in its restart, after an online update, the gnugettext.pas finds any locale.mo_NEW and renames to locale.mo before loading them.

    - I've added a {$INCLUDE Settings.inc} where the USES_LOCALE_ON_USER_DATA_PATH define is used, when not set, during debugging, to SWITCH locale path from %APPDATA%\... to development project path.

      This permits me to keep all locale.po/mo in the development sources git. The final program will use the locale path on %APPDATA%\myprogram\locale how must be.

    - Cleaned sources removing LINUX parts.
     

    osCustomize.pas, not added in attached files, just define LOCALE_NAME which can be the string 'locale' or 'locale-ppv' to have more locale libraries for two versions of same project (normal and vertical touch version, where more text are all uppercaese or short than normal version).

     

     

    gnugettext.pas

    languagecodes.pas

    osGNUGetTextUtils.pas

    osSysPath.pas

    gnugettext.pas-original


  3. I haven't followed this way but another way for Action Caption and also for Combobox items and so on.

    The issue is that translations work one time, when contents are in English (starting language) to

    any other language (for eg: EN to IT) because they are initially copied from DFM to object fields.

    When I try to switch EN to  IT and then to CZ for objects which don't recover data from DFM translations obviously doesn't work.

    But there is a solution that I use:

     

      TPageProjectWorkFrame = class(TFrame)
        ...
      private
        procedure ReTranslateEvent(Sender: TObject);
        ...
      end;
    
    uses
      gnugettext,
      ...
      osGNUGetTextUtils;
    	
    constructor TPageProjectWorkFrame.Create(AOwner: TComponent);
    begin
      inherited;
      ...
      // links object/event to translate manager and re-translate
      GNURetranslateManager.Add(Self, ReTranslateEvent);
      GNURetranslateManager.ReTranslate;
    end;
    
    destructor TPageProjectWorkFrame.Destroy;
    begin
      // unlinks object/event from translate manager
      GNURetranslateManager.Remove(Self, ReTranslateEvent);
      ...
    end;
    
    procedure TPageProjectWorkFrame.ReTranslateEvent(Sender: TObject);
    begin
      AnalysisAction.Caption := _('ANALYSIS');
      BackAction.Caption := _('BACK');
      CoordinatesModeAction.Caption := _('WCS MODE')
      HomingAAction.Caption := _('HOMING A');
      HomingAction.Caption := _('HOMING');
      HomingAllAction.Caption := _('HOMING ALL');
      HomingBAction.Caption := _('HOMING B');
      HomingCAction.Caption := _('HOMING C');
      HomingXAction.Caption := _('HOMING X');
      HomingYAction.Caption := _('HOMING Y');
      HomingZAction.Caption := _('HOMING Z');
      JogAction.Caption := _('JOG');
      MacroAction.Caption := _('MACRO');
      ShowWork3DAction.Caption := _('WORK 3D');
      ShowWorkSimulateAction.Caption := _('SIMULATE');
    end;

    The GNURetranslateManager is a singleton object which call registered objects RetranslateEvent every time a language change.

    GNURetranslateManager call internally TranslateComponents (first call) or ReTranslateComponents (next call) automatically for all
    objects which starts always from DFM english texts (as Label, Panels, etc).

    Usually I keep Actions Caption empty in the designer (but not necessary) and when RetranslateEvent is called I add _('xxx') with
    original English language to translate. This automatically update linked action objects.

    It works perfectly with Frame and Forms (VCL, never tried FMX applications).



     

    osGNUGetTextUtils.pas

    • Thanks 1

  4. I'm using dxgettext for at least 10 years, and I can say "IT WORKS" but you have to manage many things...

    I've never tried other ways, however... and this is my limit.

    Any languages have its rules for plurals, and the same term could change meanings depending on the place where it is used.

    You have to spend a lot of time creating simple but clear initial English texts.

     

    https://youtu.be/Ac3xV1X7uzE

    For dxgettext you can use PoEdit editor which helps a lot for initial translations using Google or MS online translations servicies.

     

     

     

     

     

    • Like 1

  5. There are some very good things in FMX that I would like to have in VCL....
    Migrate a full application from VCL to FMX is a nightmare and to have a way to do is not so bad.
    For new projects, I will plan to TRY the FMX world.


  6. I've already added Style in TSynEdit and it is very simple to do.
    For example, to add the Scrollbar style is only necessary to add this line:

    uses
      Vcl.Themes;
    
    {$R *.dfm}
    
    procedure TForm8.FormCreate(Sender: TObject);
    begin
      TStyleManager.Engine.RegisterStyleHook(TCustomSynEdit, TScrollingStyleHook);
    end;

    image.thumb.png.3432c7fddc76e5605d665454f99b33da.png
     

    But I don't would to enable styling in all my project BUT only to SynEdit scrollbar so this is not a way to follow.

    Perhaps I need to study a way to "extract" what Vcl.Theme manager does for TScrollingStyleHook and to apply only to my version of TCustomSynEdit...

    Unfortunately, the entire project already living with an old theme system (Light/Dark), and now I can't change it.


  7. Hi all,

    I've already used Themes, with satisfaction, on some little applications.

    In a big application, I haven't used the TStyleManager.Engine because too hard to re-design the entire application,

    but I would like to have a way to style only the scrollbars colors of a TSynEdit component.

     

    It is, in some way, possible to add ONLY the TScrollingStyleHook behavior in a program without the Style engine running?

    Thank you for your suggenstions!
     


  8. For every component is possible, in gesture options, disable the long press event (PRESSANDHOLD) to not enter in "simulated right mouse click" and perform what you need.

    You can also perform that in WndProc (for e.g. in custom components) when you use old Dephi versions (e.g BDS2006 or any version with don't have gesture management):

     

    procedure TAggButton.WndProc(var Message: TMessage);
    const
      WM_TABLET_DEFBASE                     = $02C0;
      WM_TABLET_QUERYSYSTEMGESTURESTATUS    = (WM_TABLET_DEFBASE + 12);
    const
      TABLET_DISABLE_PRESSANDHOLD           = $00000001;
      TABLET_DISABLE_PENTAPFEEDBACK         = $00000008;
      TABLET_DISABLE_PENBARRELFEEDBACK      = $00000010;
      TABLET_DISABLE_TOUCHUIFORCEON         = $00000100;
      TABLET_DISABLE_TOUCHUIFORCEOFF        = $00000200;
      TABLET_DISABLE_TOUCHSWITCH            = $00008000;
      TABLET_DISABLE_FLICKS                 = $00010000;
      TABLET_ENABLE_FLICKSONCONTEXT         = $00020000;
      TABLET_ENABLE_FLICKLEARNINGMODE       = $00040000;
      TABLET_DISABLE_SMOOTHSCROLLING        = $00080000;
      TABLET_DISABLE_FLICKFALLBACKKEYS      = $00100000;
      TABLET_ENABLE_MULTITOUCHDATA          = $01000000;
    
      {**
       *  NOTE
       *  ====
       *  https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-cursorinfo
       *
       *    CI.flags:
       *
       *                      0           The cursor is hidden.
       *    CURSOR_SHOWING    0x00000001  The cursor is showing.
       *    CURSOR_SUPPRESSED 0x00000002  Windows 8: The cursor is suppressed.
       *                                  This flag indicates that the system is not drawing the cursor because the user is
       *                                  providing input through touch or pen instead of the mouse.
       *
       *  Minimum supported client	Windows 2000 Professional [desktop apps only].
       *
       **}
      function IsMouseCursorVisible: Boolean;
      var
        CI: TCursorInfo;
      begin
        CI.cbSize := SizeOf(CI);
        Result := GetCursorInfo(CI) and (CI.flags = CURSOR_SHOWING);
      end;
    
    begin
      case Message.Msg of
        CM_TEXTCHANGED:
          Invalidate;
        CM_VISIBLECHANGED:
        begin
          Invalidate;
        end;
        CM_ENABLEDCHANGED:
        begin
          FSVGSupportChanged := True;
          Invalidate;
        end;
        CM_MOUSEENTER:
        begin
          if not FMouseInControl then
          begin
            FMouseInControl := IsMouseCursorVisible;
            if FMouseInControl then Invalidate;
          end;
        end;
        CM_MOUSELEAVE:
        begin
          if FMouseInControl then
          begin
            FMouseInControl := False;
            Invalidate;
          end;
        end;
        WM_ERASEBKGND:
        begin
          Message.Result := 1;
          Exit;
        end;
        WM_MOUSELEAVE:
        begin
        end;
        WM_TABLET_QUERYSYSTEMGESTURESTATUS:
        begin
          Message.Result :=
          (
            TABLET_DISABLE_PRESSANDHOLD or
            TABLET_DISABLE_PENTAPFEEDBACK or
            TABLET_DISABLE_PENBARRELFEEDBACK or
            TABLET_DISABLE_TOUCHUIFORCEON or
            TABLET_DISABLE_TOUCHUIFORCEOFF or
            TABLET_DISABLE_TOUCHSWITCH or
            TABLET_DISABLE_FLICKS or
            TABLET_DISABLE_SMOOTHSCROLLING or
            TABLET_DISABLE_FLICKFALLBACKKEYS
          );
          Exit;
        end;
      end;
      inherited WndProc(Message);
    end;

    In this case you have also to enable touch management with:

     

        procedure CreateWnd; override;
        procedure DestroyWnd; override;
    
    procedure TAggButton.CreateWnd;
    begin
      inherited;
    
      if csLoading in ComponentState then Exit;
      if not FTouchInitialized and TOSVersion.Check(6, 1) and RegisterTouchWindow(Handle, 0) then
        FTouchInitialized := True;
    end;
    
    procedure TAggButton.DestroyWnd;
    begin
      if FTouchInitialized then
      begin
        UnregisterTouchWindow(Handle);
        FTouchInitialized := False;
      end;
    
      inherited;
    end;

     


  9. Hi all,

    I'm trying to use igZoom gesture in a VCL application but doesn't work.

    It works perfectly in an FMX application.

     

    1] Create an FMX empty application for WIN.

    2] Add GestureManager

    3] Add a Panel and assign the GestureManager

    4] Add igZoom feature in Panel Touch Interactive Gestures
    5] Add an event handler for Panel OnGesture 
    6] Increment a counter and show in the caption for every OnGesture event:

     

    var Count: Integer;
    
    procedure TForm8.Panel1Gesture(Sender: TObject; const EventInfo: TGestureEventInfo; var Handled: Boolean);
    begin
      Inc(Count);
      Caption := IntToStr(Count);
    end;


    1] Create a VCL empty application

    2 to 6 as made for FMX application

     

    At this point the two applications, FMX and VCL are the same.

     

    Running FMX application when I put two fingers on the touch screen the zoom in/out movements creates a continuous flow of OnGesture: OK works fine.

    Running VCL application when I put two fingers on the touch screen the zoom in/out movements don't create OnGesture event but is created only when I remove the fingers.


    I don't know why FMX works: till I'm zooming I've got a lot of OnGesture events to track the zoom IN/OUT activity,
    but with VCL I've got ONLY one event with ID = 0 when I leave the fingers from the touch screen.

    Thank you for help !!!


  10. Hi to all,

     

    I've moved a lot of code from BDS2006 to Sydney and now it's time to finish DLL interfacing.
    Support DLLs are at moment in AnsiString so input parameters are as PAnsiChar, but overall calling

    code is ready to use Unicode strings (I'm waiting the right time to convert the DLL).

    When strings are emptied a nil pointer must be sent to DLL arguments.

    As a workaround I've two solutions, one fine to see but I don't know if will work in all cases.
    The second way could work fine always:
     

    { first mode }
    function StringToAnsiCPointer(const S: string): PAnsiChar; inline;
    
    function StringToAnsiCPointer(const S: string): PAnsiChar;
    begin
      if Length(S) = 0 then
        Result := nil
      else
        Result := PAnsiChar(AnsiString(S));
    end;
    
    function CompilerEncryptFile(const TextFileName: string; Key: TCNCEncryptKey; const EncryptedFileName: string): Longint;
    begin
      Result := _CompilerEncryptFile	// DLL CALL
      (
        StringToAnsiCPointer(TextFileName),
        @Key,
        StringToAnsiCPointer(EncryptedFileName)
      );
    end;
    
    { SECOND MODE }
    
    function CompilerEncryptFile(const TextFileName: string; Key: TCNCEncryptKey; const EncryptedFileName: string): Longint;
    begin
      Result := _CompilerEncryptFile
      (
        IIf(Length(TextFileName) = 0, nil, PAnsiChar(AnsiString(TextFileName))),
        @Key,
        IIf(Length(EncryptedFileName) = 0, nil, PAnsiChar(AnsiString(EncryptedFileName)))
      );
    end;

     

    My dubs in the first mode are concerning the LIFE of temporary cast to AnsiString in the line:
    PAnsiChar(AnsiString(S) as a result of the external function.

    Do you have some ideas about it?


  11. Hi developers,
    I am moving a project from BDS2006 to Sydney.
    I have strange behavior when debugging with Sydney, the program slows down a lot, and becomes almost unusable.

    In BDS2006 there is no noticeable difference between running a program in debug or without debugging which helps a lot in the development.

    In Sydney, this is not the case, and to understand if some changes bring about performance improvements or not, all that remains is to run without debugging and disseminate the log code ... Frustrating.

    I am attaching a video that highlights how the behavior changes between the two ways of running a program.

    When running in Sydney the system becomes so slow that the thread sending data via TCP / IP to the connected device cannot keep up with the data request. Everything is slowed down and jerky.

    Do you have any idea what might go wrong?

    PS: During the installation of the IDE I also installed the Parnassus Debugger, doesn't this considerably increase the load in the execution of programs in Debug?
    I obviously use a lot of threads but not a lot to bring the process to its knees.
    As you can see, when it is not debugged, the CPU used by the program aligns itself on 1-2%.

    Thanks in advance for the suggestions.

     

    https://youtu.be/eLTVhPkn0NA


  12. 2 hours ago, Der schöne Günther said:

    That's what I do as well: I just change the systems keyboard layout so the TTouchkeyboard will follow. When not longer needed, you can also unload the English keyboard layout again so it will not show up ion the users language list ([Win] + [Space]).

    Yes, I've already tried that, but, end-user will have a touch keyboard to enter code in the display panel + a physical keyboard (Japanese or Russian in this case) to enter texts in native Unicode mode.
    I need to have Windows working with Japanese or Russian native user language but the touch keyboard with the US for fast code editing in the display keybaord.

    I'm trying to understand TTouchKeyboard to "overload" how works o I will move to a custom keyboard component created from zero.


  13. This is the "English" layout that I mean:
    usenglish-windows-keyboard-layout-keyshorts_1024x1024.thumb.jpg.8d36067243b6414d1272b27f39a609db.jpg
    I can obtain this layout "forcing" the entire system to use US keyboard layout language instead of "IT" with:

    ActivateKeyboardLayout(67699721 {en-US}, 0);
    Application.ProcessMessages;
    TouchKeyboard1.Redraw;

    but I wouldn't change how the physical keyboard works, overall the native customer keyboard,

    for eg. is Japanese and would use a physical keyboard to edit strings,

    but only the TTouchKeyboard component layout.


  14. Hi all.

     

    I'm on a PC with the Italian language and an Italian true keyboard.
    In the VCL software, I would like to use the TTouchKeyboard.

    Is a technical software where I need to force TTouchKeyoard to display US keyboard layout,

    because chars as [ ] | # etc are mandatory instead of accented èéòàù of  specific Italian layout.

     

    I've imported the Vcl.Touch.Keyboard.pas in project to add minor graphics changes, which works fine,

    but I'm not able to understand how to force English layout.

     

    I've tried to change CreateKeyboard method to say "use alwyas 'en' but doesn't works.

     

    function TCustomTouchKeyboard.CreateKeyboard(const Language: string): Boolean;
    var
      Index, RowIndex, ColIndex: Integer;
      Button: TCustomKeyboardButton;
      LeftPosition, TopPosition: Integer;
      KeyboardState: TKeyboardState;
      KeyboardLayout: TVirtualKeyLayout;
      Row: TVirtualKeys;
      FoundCaps: Boolean;
      _Language: string;
    begin
      Result := False;
      FoundCaps := False;
      for Index := 0 to FButtons.Count - 1 do
        FButtons[Index].Free;
      FButtons.Clear;
      FDeadKey := VKey(-1, -1);
      TopPosition := 0;
    
      _Language := 'en';
      if _Language <> '' then
        FLanguage := _Language;


    The result is always:
    image.thumb.png.3cbebac0f28a47c4713b29f1d1dfc2d0.png

     

    There is a way to force it ?


  15. For BDS2006, I've found this solution to disable the press and hold only to required components.
    For Sydney there is Touch.TabletOptions does the same things.

     

    procedure TAggKnob.WndProc(var Message: TMessage);
    const
      WM_TABLET_DEFBASE                     = $02C0;
      WM_TABLET_QUERYSYSTEMGESTURESTATUS    = (WM_TABLET_DEFBASE + 12);
    const
      TABLET_DISABLE_PRESSANDHOLD           = $00000001;
      TABLET_DISABLE_PENTAPFEEDBACK         = $00000008;
      TABLET_DISABLE_PENBARRELFEEDBACK      = $00000010;
      TABLET_DISABLE_TOUCHUIFORCEON         = $00000100;
      TABLET_DISABLE_TOUCHUIFORCEOFF        = $00000200;
      TABLET_DISABLE_TOUCHSWITCH            = $00008000;
      TABLET_DISABLE_FLICKS                 = $00010000;
      TABLET_ENABLE_FLICKSONCONTEXT         = $00020000;
      TABLET_ENABLE_FLICKLEARNINGMODE       = $00040000;
      TABLET_DISABLE_SMOOTHSCROLLING        = $00080000;
      TABLET_DISABLE_FLICKFALLBACKKEYS      = $00100000;
      TABLET_ENABLE_MULTITOUCHDATA          = $01000000;
    var
      P: TPoint;
    begin
      case Message.Msg of
        WM_TABLET_QUERYSYSTEMGESTURESTATUS:
        begin
          Message.Result :=
          (
            TABLET_DISABLE_PRESSANDHOLD or
            TABLET_DISABLE_PENTAPFEEDBACK or
            TABLET_DISABLE_PENBARRELFEEDBACK or
            TABLET_DISABLE_TOUCHUIFORCEON or
            TABLET_DISABLE_TOUCHUIFORCEOFF or
            TABLET_DISABLE_TOUCHSWITCH or
            TABLET_DISABLE_FLICKS or
            TABLET_DISABLE_SMOOTHSCROLLING or
            TABLET_DISABLE_FLICKFALLBACKKEYS
          );
          P.X := TWMMouse(Message).XPos;
          P.Y := TWMMouse(Message).YPos;
          P := ScreenToClient(P);
          MouseDown(mbLeft, [], P.X, P.Y);
          Exit;
        end;
      end;
      inherited WndProc(Message);
    end;

     

×