Forum Replies Created
-
AuthorPosts
-
February 1, 2024 at 5:10 am in reply to: Application using Alpha Skins in Delphi 12 shows two program windows on the task #71424LasseParticipant
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;
LasseParticipantIt 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.
LasseParticipantI use dark skins a lot in my projects and you can get it working.
Attachments:
You must be logged in to view attached files.LasseParticipantSee https://www.alphaskins.com/forum/?topic=treeview-and-fluennight-skin
It is the same issue.
LasseParticipantYes, 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.
LasseParticipantYou 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.
LasseParticipantReading 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.
LasseParticipantHere it comes. Include file also included.
Attachments:
You must be logged in to view attached files.LasseParticipantI also see the Yukon became Athens. I will fix the project files and upload them soon.
LasseParticipantOoops, that is my own control. You can delete it.
LasseParticipantThis 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 likeWinapi.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
LasseParticipantFix:
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.
LasseParticipantThere seems to be the same white border issue like with Alexandria at first.
Attachments:
You must be logged in to view attached files.LasseParticipantThis 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.
LasseParticipantSetting 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…
LasseParticipantBuilding > Delphi Compiler > Linking > Support address space layout randomization (ASLR)
LasseParticipantSounds like an ASLR (Address Space Layout Randomization) issue. Have you tried to set if False in linker options?
July 28, 2023 at 6:03 am in reply to: TsSkinProvider.PaintAll -> GDIError (EOutOfResources = out of memory) #71302LasseParticipantYes, FreeAndNil(FTextTimer) is ok.
TTimer destroy will disable it.
destructor TTimer.Destroy; begin FEnabled := False; ...
July 28, 2023 at 6:01 am in reply to: TsSkinProvider.PaintAll -> GDIError (EOutOfResources = out of memory) #71301LasseParticipantYou 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, CreateRectRgnIndirectI 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;
LasseParticipantIf 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.
-
AuthorPosts