Jump to content

how do i change the theme at runtime


Darlan

Recommended Posts

  • 3 weeks later...
On 28/01/2023 at 23:52, Sherzod said:

Olá, 

Exatamente em que momento?

coloquei um botão no config, que selecione 2 temas.
Exemplo: UniMainModule.Theme:= 'aria';
Me informaram para ver o exemplo no Demo ThemeChange mas este demo não compila


I put a button in the config, which selects 2 themes.

Example: UniMainModule.Theme:= 'aria';

Let me know to see the example in the ThemeChange Demo but this demo doesn't compile.

how to allow user to switch to another theme?
 

Link to comment
Share on other sites

34 minutes ago, Darlan said:

coloquei um botão no config, que selecione 2 temas.
Exemplo: UniMainModule.Theme:= 'aria';
Me informaram para ver o exemplo no Demo ThemeChange mas este demo não compila


I put a button in the config, which selects 2 themes.

Example: UniMainModule.Theme:= 'aria';

Let me know to see the example in the ThemeChange Demo but this demo doesn't compile.

how to allow user to switch to another theme?
 

Hello,

I use Combobox with all Themes and show this on MainForm

to change Theme just add this:

on UniComboBox_ThemeChange ();

begin

If UniComboBox_Theme.ItemINdex <> -1 then
    UniMainModule.Theme := UniComboBox_Theme.Text;

end;

You need to make         UniMainModule.RecallLastTheme := False or True;

 

here is how to load all themes in Combo:

var

S                     : TUniStringArray;
ThemeI                : Integer;

begin

    S := UniServerModule.ThemeManager.AllThemes;
    TRY
      UniComboBox_Theme.Items.BeginUpdate;
      UniComboBox_Theme.Items.Clear;
      for ThemeI := Low(S) to High(S) do
          UniComboBox_Theme.Items.Add(S[ThemeI]);

      UniComboBox_Theme.Text := UniMainModule.Theme;
    FINALLY
      UniComboBox_Theme.Items.EndUpdate;
    END;
end;

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...