Lasse

Forum Replies Created

Viewing 20 posts - 21 through 40 (of 212 total)
  • Author
    Posts
  • 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 2 years, 4 months 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 2 years, 7 months ago by Lasse.
                  in reply to: Error in sSpinnedit on double click #71296
                  Lasse
                  Participant

                    I can confirm this issue is happening with the latest version. I will try to fix it.

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

                      Have you tried to recreate your project file? If it works, you can compare what is causing the issue.

                      Lasse
                      Participant

                        That said… for example find “CreatePen” from AlphaSkins source and you will find a leak in sGraphUtils.pas:

                        SelectObject(DC, CreatePen(PS_SOLID, 2, clWhite));

                        That will create a pen and it is never deleted. The code should be like:

                        var
                          LPen: HPEN;
                        begin
                          LPen := CreatePen(...);
                          try
                            // Use the pen for drawing
                          finally
                            DeleteObject(LPen); // Release the GDI pen object
                          end;
                        end;
                        • This reply was modified 2 years, 7 months ago by Lasse.
                        Lasse
                        Participant

                          I recommend asking ChatGPT e.g. “How to track GDIError (EOutOfResources = out of memory) errors in Delphi?”. It gives an excellent answer.

                          I bet my money on creating GDI objects and not deleting them somewhere. I have seen that thousand times.

                          in reply to: How to change the font color of disabled control? #71273
                          Lasse
                          Participant

                            Set SkinData.CustomFont = True and set Font.Color.

                            in reply to: TPageControl not getting skinned #71252
                            Lasse
                            Participant

                              Use TsPageControl or add TPageControl to skin manager’s ThirdParty property.

                              in reply to: Support Delphi7 #71178
                              Lasse
                              Participant

                                Delphi 7 was released 2002 and used to be my favorite version for a very long time. But try to develop components for modern Delphi and you will understand why it is a huge burden to support old versions. Personally I wouldn’t support anything before Delphi XE2. Unit scopes are a must.

                                in reply to: Custom color for TsTabSheet #71175
                                Lasse
                                Participant

                                  I played with that TsSkinManager.CommonSections a bit and it solves the problem. Thanks a lot.

                                  Lasse
                                  Participant

                                    Add a break point to message dialog execution.

                                    Lasse
                                    Participant

                                      Have you debugged where that is coming from? I have not come across this and I have the same versions of Delphi and AlphaControls in use.

                                      Lasse
                                      Participant

                                        Yes, everything works perfect now.

                                        in reply to: Pray that the developers are still alive. #71135
                                        Lasse
                                        Participant

                                          Good to know you’re ok.

                                          in reply to: Pray that the developers are still alive. #71133
                                          Lasse
                                          Participant

                                            It requires auto-renew to be turned on in your renewal and billing settings. But yes, not all service providers may have such an option.

                                          Viewing 20 posts - 21 through 40 (of 212 total)