Luciano França Posted September 1, 2023 Share Posted September 1, 2023 I need to change the color of Icons at runtime according to the type of Themes that the user chooses I believe it is a bug because it gives an AccessViolation error procedure TMainForm.UniButton1Click(Sender: TObject); Var I : Integer; begin for I := 0 to UniNativeImageList1.Count - 1 do UniNativeImageList1.Images[I].FontColor := clwhite; end; Quote Link to comment Share on other sites More sharing options...
Luciano França Posted September 4, 2023 Author Share Posted September 4, 2023 On 9/1/2023 at 11:50 AM, Luciano França said: I need to change the color of Icons at runtime according to the type of Themes that the user chooses I believe it is a bug because it gives an AccessViolation error procedure TMainForm.UniButton1Click(Sender: TObject); Var I : Integer; begin for I := 0 to UniNativeImageList1.Count - 1 do UniNativeImageList1.Images[I].FontColor := clwhite; end; I believe it is a bug in the "UniNativeImageList" component because it cannot access the list in "UniNativeImageList.Images" In this way, my solution for those who need it is Procedure TForm_MenuPrincipal.P_ColorSkinWeb; Var I: Integer; Var ColorIcons: TColor; Var ListIcons: TStrings; Var aFontFamily: TUniIconFontFamily; Begin if Not AnsiSameText(PathSkinName, 'uni_ubuntu') then Exit; ListIcons := TStringList.Create; Try for I := 0 To WEB_IconFontsListMenu.Count - 1 do ListIcons.AddObject(WEB_IconFontsListMenu.GetIconCls(I, aFontFamily, ColorIcons), TObject(aFontFamily)); if AnsiSameText(PathSkinName, 'uni_ubuntu') then ColorIcons := clWhite Else ColorIcons := clBlack; WEB_IconFontsListMenu.Clear; for I := 0 to ListIcons.Count - 1 do if Trim(ListIcons.Strings[I]) <> EmptyStr Then WEB_IconFontsListMenu.AddIconCls(ListIcons.Strings[I], TUniIconFontFamily(ListIcons.Objects[I]), ColorIcons); Finally FreeAndNil(ListIcons); End; End; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.