Lasse

Forum Replies Created

Viewing 20 posts - 1 through 20 (of 205 total)
  • Author
    Posts
  • Lasse
    Participant

    I have had the same issue with Delphi 11.3 without AlphaSkins. I think I tackled this by overriding CreateParams…

    procedure CreateParams(var Params: TCreateParams); override;
    
    procedure TMainBaseForm.CreateParams(var Params: TCreateParams);
    begin
      inherited CreateParams(Params);
    
      with Params do
      begin
        ExStyle := ExStyle and not WS_EX_APPWINDOW;
        WndParent := Application.Handle;
      end;
    end;
    in reply to: At 150% the TsTreeView nodes become very small #71419
    Lasse
    Participant

    It is not about Windows dark mode but control dark theme. SetWindowTheme is getting the control handle as a parameter.

    Winapi.UxTheme.SetWindowTheme(Handle, PWideChar(‘DarkMode_Explorer’), nil);

    So, you just need to decide when the used control skin is dark and then set the theme for it. These are Windows controls at their core and the arrow painting is coming there. It is also possible to draw those arrows by yourself but then you also need to decide when the control is dark.

    in reply to: At 150% the TsTreeView nodes become very small #71414
    Lasse
    Participant

    I use dark skins a lot in my projects and you can get it working.

    Attachments:
    You must be logged in to view attached files.
    in reply to: At 150% the TsTreeView nodes become very small #71412
    Lasse
    Participant
    in reply to: Delphi 12 is coming #71392
    Lasse
    Participant

    Yes, you need the source code for that. There is a quite huge reason why the AlphaSkins is not updated. The war is still going on.

    in reply to: Delphi 12 is coming #71371
    Lasse
    Participant

    You can create C++ project files from the Alexandria files by yourself. No information on when the official project files will come, if they ever will.

    in reply to: Set margin for close button of page control tab #71368
    Lasse
    Participant

    Reading the code reveals that there is no property for this. But in TsPageControl.InitTabContentData you see that there is BtnOffsX which is constant. That procedure will initialize the dContent parameter for TsPageControl.PaintButton.

    const
      BtnOffsX = 4; // Offset of the Close button from right border

    You need to fix the original code to move it. However, I think that close button is exactly in the right place. Or maybe you are using some skin which is not ok.

    • This reply was modified 1 year ago by Lasse.
    in reply to: Delphi 12 is coming #71365
    Lasse
    Participant

    Here it comes. Include file also included.

    Attachments:
    You must be logged in to view attached files.
    in reply to: Delphi 12 is coming #71364
    Lasse
    Participant

    I also see the Yukon became Athens. I will fix the project files and upload them soon.

    in reply to: Delphi 12 is coming #71363
    Lasse
    Participant

    Ooops, that is my own control. You can delete it.

    in reply to: TreeView and FluenNight skin #71360
    Lasse
    Participant

    This depends on your code. The point is to call the Winapi.UxTheme.SetWindowTheme. You can do this in many different places.

    1. Inherit TsTreeView control and add for example WindowTheme property to set it
    2. Use interposer class TsTreeView = class(sTreeView.TsTreeView) and do the same
    3. Fix the original TsTreeView code and do the same
    4. Call it when initializing your form like

    Winapi.UxTheme.SetWindowTheme(YourTreeView.Handle, PWideChar(‘DarkMode_Explorer’), nil);

    I don’t know what is the best solution for you. If you are using TsTreeView more than 1 place, then I suggest the first. I also suggest using virtual treeview control https://github.com/JAM-Software/Virtual-TreeView

    in reply to: Delphi 12 is coming #71355
    Lasse
    Participant

    Fix:

    sDefs.inc: {$IFDEF VER360} {$DEFINE DELPHI_12}{$ENDIF}

    sSkinProvider.pas

    
    function SysBorderWidth(...
    ...
    {$IF DEFINED(DELPHI_11) OR DEFINED(DELPHI_12)} // {$IFDEF DELPHI_11} 

    There are also two other DELPHI_11 ifdefs which must be fixed.

    • This reply was modified 1 year ago by Lasse.
    in reply to: Delphi 12 is coming #71353
    Lasse
    Participant

    There seems to be the same white border issue like with Alexandria at first.

    Attachments:
    You must be logged in to view attached files.
    in reply to: TreeView and FluenNight skin #71351
    Lasse
    Participant

    This is actually an issue with all dark skins. I had the same issue with virtual tree control and I fixed it for dark skins by calling:

    Winapi.UxTheme.SetWindowTheme(Handle, PWideChar(‘DarkMode_Explorer’), nil);

    Handle is the control handle. For light skins the theme is ‘explorer’.

    Note! This works only since Windows 10 build 17763. You need to check it.

    if DefaultManager.Active and CheckWin32Version(10) and (TOSVersion.Build >= 17763) then
    begin
      if ColorIsDark(DefaultManager.GetActiveEditColor) then
        AVirtualTree.WindowTheme := 'DarkMode_Explorer'
      else
        AVirtualTree.WindowTheme := 'explorer';
    end;
    • This reply was modified 1 year ago by Lasse.
    in reply to: ACCESS VIOLATION in Delphi 11.2 #71319
    Lasse
    Participant

    Setting it to false is only a temporary solution. It just shows that there are bugs in the code. For example there are pointers casted to Integer when those must be casted to NativeInt. I have fixed a lot of those but not all. I also have to still keep that setting false…

    in reply to: ACCESS VIOLATION in Delphi 11.2 #71317
    Lasse
    Participant

    Building > Delphi Compiler > Linking > Support address space layout randomization (ASLR)

    in reply to: ACCESS VIOLATION in Delphi 11.2 #71312
    Lasse
    Participant

    Sounds like an ASLR (Address Space Layout Randomization) issue. Have you tried to set if False in linker options?

    Lasse
    Participant

    Yes, FreeAndNil(FTextTimer) is ok.

    TTimer destroy will disable it.

    destructor TTimer.Destroy;
    begin
      FEnabled := False;
      ...
    Lasse
    Participant

    You can check what objects can be created for SelectObject.

    – Bitmap: CreateBitmap, CreateBitmapIndirect, CreateCompatibleBitmap, CreateDIBitmap, CreateDIBSection
    – Brush: CreateBrushIndirect, CreateDIBPatternBrush, CreateDIBPatternBrushPt, CreateHatchBrush, CreatePatternBrush, CreateSolidBrush
    – Font: CreateFont, CreateFontIndirect
    – Pen: CreatePen, CreatePenIndirect
    – Region: CombineRgn, CreateEllipticRgn, CreateEllipticRgnIndirect, CreatePolygonRgn, CreateRectRgn, CreateRectRgnIndirect

    I have mostly seen CreatePen and CreateBrush leaks. But there are also many other kind of traps to fall into. The worst I know is SHGetFileInfo where you need to destroy the icon handle, if you are not using it. Usually you’re only interested in icon index.

    For example

    function GetIconIndex(const AFilename: string; const AFileAttributes: Cardinal; const AMoreFlags: Cardinal): Integer;
    var
      LFileInfo: TSHFileInfo;
    begin
      if SHGetFileInfo(PChar(AFilename), AFileAttributes, LFileInfo, SizeOf(TSHFileInfo), SHGFI_SYSICONINDEX or SHGFI_SMALLICON or
        SHGFI_ICON or AMoreFlags) = 0 then
        Result := -1
      else
      begin
        Result := LFileInfo.iIcon;
        { Important! Destroy the icon, we are only using the index. }
        DestroyIcon(LFileInfo.hIcon);
      end;
    end;
    in reply to: Error in sSpinnedit on double click #71299
    Lasse
    Participant

    If you have source codes (sSpinEdit.pas), you can fix this like:

    procedure TsBaseSpinEdit.WndProc(var Message: TMessage);
    ...
        CM_MOUSELEAVE: begin
          // ==> Fix starts
          if Assigned(FRepeatTimer) then 
            FreeAndNil(FRepeatTimer);
    
          MousePressed := False; 
          // <== Fix ends
          if Btn1State > 0 then
            Btn1State := 0;

    If you don’t have source code, you need to inherit TsSpinEdit and override WndProc.

    • This reply was modified 1 year, 3 months ago by Lasse.
Viewing 20 posts - 1 through 20 (of 205 total)