Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Share Me

  • Please share this topic with your friends. Click any of the icons below:
  • Twitter
  • facebook
  • reddit
  • email

How to Activate XP Themes.

Using Delphi XE2 and LMD 2012 under Windows XP SP3.

My application now has XP Themes activated, and as would be expected, all Delphi and most third-party controls now have the style of the selected theme, for sake of argument: Aqua Light Slate. However, none of the many LMD Tools components have changed their appearance.

On the main form I have included LMDClass and LMDXPRes, and in the mainform OnCreate event the code:

   LMDApplication.UseXPThemes := True;

 

Why does this not work ??

What more must I do to get XP themes working with LMDTools 2012 ???

Comments

  • 10 Comments sorted by Votes Date Added
  • Aqua Light Slate sounds like VCL Styles, not XP Themes. 
    Are you sure you mean XP Themes? Or do you mean VCL Styles? In any case there is no special action to support VCL Styles. Simply make sure that ThemeMode property of controls do not disable Themes support-
    I am not sure which LMD controls did already support VCL Styles in LMD 2012 releases, but in the two folloing releases many more controls received VCL Styles support (.g. LMD GridPack received full VCL Styles support in LMD 2014 release). If there are controls in LMD 2012 which do not support VCL Styles, either ThemeMode is wrong or the control simply does not support VCL Styles at this time.




  • Rafa,

    You are, of course, correct: I'm referring to VCL Styles, not XP Themes.

    The most-used components directly causing a problem now are TLMDEdit, TLMDSimplePanel, TLMDButton and TLMDSimpleLabel, as shown in the attached example program.

    The standard delphi components have the correct appearance depending on the chosen style. The LMD ones do not all change their appearance: only the Spin Edit and Simple Buttons seem to change. Behaviour is independent of the setting or not of TLMDApplication.UseXPThemes.

    JF

     

  • Uploading a 2 kb file just goes on and on and on, so I can assume that doesn't work.

    Here is the dfm file MainForm:

    object MainForm: TMainForm
      Left = 1976
      Top = 84
      Caption = 'MainForm'
      ClientHeight = 444
      ClientWidth = 612
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      OnCreate = FormCreate
      PixelsPerInch = 96
      TextHeight = 13
      object Label1: TLabel
        Left = 16
        Top = 36
        Width = 90
        Height = 13
        Caption = 'Standard Delphi'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object Label2: TLabel
        Left = 128
        Top = 9
        Width = 34
        Height = 13
        Caption = 'Panel:'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object Label4: TLabel
        Left = 16
        Top = 131
        Width = 101
        Height = 13
        Caption = 'LMD Components:'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object LMDSimpleLabel1: TLMDSimpleLabel
        Left = 128
        Top = 113
        Width = 290
        Height = 15
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
        Caption = 'TLMDSimplePanel (Bevel: bmStandard, IsLowered):'
        Options = []
      end
      object LMDSimpleLabel2: TLMDSimpleLabel
        Left = 128
        Top = 242
        Width = 417
        Height = 15
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
        Caption =
          'TLMDSimplePanel (Bevel: bmCustom, Inner: bvLowered, Outer: bvRai' +
          'sed):'
        Options = []
      end
      object Label5: TLabel
        Left = 16
        Top = 52
        Width = 92
        Height = 13
        Caption = '      Components:'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object Panel1: TPanel
        Left = 128
        Top = 24
        Width = 285
        Height = 69
        BorderWidth = 1
        BorderStyle = bsSingle
        TabOrder = 0
        object Label3: TLabel
          Left = 8
          Top = 44
          Width = 71
          Height = 13
          Caption = 'TLabel in panel'
        end
        object Button1: TButton
          Left = 8
          Top = 3
          Width = 97
          Height = 29
          Caption = 'Button1'
          TabOrder = 0
        end
        object Edit1: TEdit
          Left = 168
          Top = 7
          Width = 85
          Height = 21
          TabOrder = 1
          Text = 'Edit1'
        end
      end
      object LMDSimplePanel1: TLMDSimplePanel
        Left = 128
        Top = 128
        Width = 420
        Height = 96
        Bevel.Mode = bmStandard
        Bevel.StandardStyle = lsLowered
        TabOrder = 1
        object LMDSimpleLabel3: TLMDSimpleLabel
          Left = 12
          Top = 71
          Width = 179
          Height = 15
          Caption = 'TLMDSimpleLabel in TLMDSimplePanel'
          Options = []
        end
        object LMDButton1: TLMDButton
          Left = 12
          Top = 12
          Width = 85
          Height = 21
          Caption = 'LMDButton1'
          TabOrder = 0
        end
        object LMDEdit1: TLMDEdit
          Left = 136
          Top = 12
          Width = 105
          Height = 21
          Bevel.Mode = bmWindows
          Caret.BlinkRate = 530
          TabOrder = 1
          CustomButtons = <>
          PasswordChar = #0
          Text = 'TLMDEdit'
        end
        object LMDSpinEdit1: TLMDSpinEdit
          Left = 136
          Top = 44
          Width = 129
          Height = 21
          Bevel.Mode = bmWindows
          Caret.BlinkRate = 530
          TabOrder = 2
          AutoSelect = True
          CustomButtons = <>
          Value = 0
        end
      end
      object LMDSimplePanel2: TLMDSimplePanel
        Left = 128
        Top = 263
        Width = 420
        Height = 96
        Bevel.StyleInner = bvLowered
        Bevel.StyleOuter = bvRaised
        Bevel.WidthInner = 2
        Bevel.Mode = bmCustom
        TabOrder = 2
        object LMDSimpleLabel4: TLMDSimpleLabel
          Left = 12
          Top = 71
          Width = 179
          Height = 15
          Caption = 'TLMDSimpleLabel in TLMDSimplePanel'
          Options = []
        end
        object LMDButton2: TLMDButton
          Left = 12
          Top = 12
          Width = 93
          Height = 21
          Caption = 'LMDButton2'
          TabOrder = 0
        end
        object LMDSpinEdit2: TLMDSpinEdit
          Left = 136
          Top = 44
          Width = 133
          Height = 21
          Bevel.Mode = bmWindows
          Caret.BlinkRate = 530
          TabOrder = 1
          AutoSelect = True
          CustomButtons = <>
          Value = 0
        end
        object LMDEdit2: TLMDEdit
          Left = 136
          Top = 12
          Width = 101
          Height = 21
          Bevel.Mode = bmWindows
          Caret.BlinkRate = 530
          TabOrder = 2
          CustomButtons = <>
          PasswordChar = #0
          Text = 'TLMDEdit'
        end
      end
    end

    followed by the pas file:

    unit FormMainForm;

    interface

    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,

      LMDClass,

      LMDBaseControl, LMDBaseGraphicControl, LMDBaseLabel, LMDCustomSimpleLabel,
      LMDSimpleLabel, LMDControl, LMDCustomControl, LMDCustomPanel,
      LMDCustomBevelPanel, LMDSimplePanel, LMDCustomMaskEdit, LMDCustomExtSpinEdit,
      LMDSpinEdit, LMDBaseEdit, LMDCustomEdit, LMDEdit, LMDCustomButton, LMDButton;

    type
      TMainForm = class(TForm)
        Panel1: TPanel;
        Label1: TLabel;
        Label2: TLabel;
        Button1: TButton;
        Edit1: TEdit;
        Label3: TLabel;
        LMDSimplePanel1: TLMDSimplePanel;
        Label4: TLabel;
        LMDSimpleLabel1: TLMDSimpleLabel;
        LMDSimplePanel2: TLMDSimplePanel;
        LMDSimpleLabel2: TLMDSimpleLabel;
        Label5: TLabel;
        LMDButton1: TLMDButton;
        LMDButton2: TLMDButton;
        LMDEdit1: TLMDEdit;
        LMDSpinEdit1: TLMDSpinEdit;
        LMDSpinEdit2: TLMDSpinEdit;
        LMDEdit2: TLMDEdit;
        LMDSimpleLabel3: TLMDSimpleLabel;
        LMDSimpleLabel4: TLMDSimpleLabel;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      MainForm: TMainForm;

    implementation

    {$R *.dfm}

    procedure TMainForm.FormCreate (Sender: TObject);
    begin
      LMDApplication.UseXPThemes := True;
    end;

    end.

    Sorry for the inconvenience sending the samplr this way, but attaching a zip file to my post doesn't seem to work for some reason.

    JF

     

  • edited January 2014 Posts: 0Vote Up0Vote Down
    I don't see any problems (note: you forgot to set the ParentBackground property of the panels, so that panels take background color of the parent container). See image:
    image

    Again: Setting UseXPThemes is not required (and legacy also. One would use now LMDApplication.ThemeGlobalMode).

    Note for the future:
    Simply send zip file to mail@lmdsupport.com and rename the file to myfile(dot)zip
  • edited January 2014 Posts: 6Vote Up0Vote Down

    Rafa,

    That made a big improvement, but as you will see from the image, there is still something wrong with the labels and edits. Should the label colours adjust to take into account the change in colour of the background, as do the standard Delphi labels?? Likewise, the edits??

    image

     I have not been able to reproduce your result, no matter which VCL style I choose. The one used in the image above best shows the discrepancies. Could it be that I'm still using the 2012 version ?? Have these components been improved in this respect in later versions ???

    I have noted for future reference your indication as to how to send zip files and such. Thanks.

  • Any further suggestions on this one ???  From Rafa, or anyone else ???

    If there is no solution for this, I'm facing having to eliminate LMD components from over 200 forms, with many panels, buttons with multi-line labels, some buttons being longer vertically than horizontally and with a text one letter per line, multi-line labels, spin edits, labelled edits, etc., etc., etc.

    Would upgrading to LMDTools 2014 solve this problem ??  I can't recommend that course without first knowing it IS the solution. To recommend it and then have to wriggle out later when it doesn't work is not an option.

    To remove LMD altogether from the program is also out of the question. Too expensive, and at my expense, to boot.

    --

    JF

    PD: The style used in the above image is most likely not the style that will finally be used. That decision is open as yet. First do a partial conversion, then choose a style, then complete the job.

     

  • >>Any further suggestions on this one ??? <<
    I am sorry, but for several controls you won't achieve same look. 
    For example LMD Labels never support themes or theme colors. So upgrading to LMD 2014 would not help.
  • Disappointed to hear that labels don't support theme colours, Rafa. However, it may not be a big deal.

    Can you confirm, as the image you posted earlier seems to show, that edits (simple, labelled and spin) in LMDTools 2014 do conform ??? If so, the solution could be as simple as choosing a light-coloured style, as you have used above. The labels in black on that form look OK. And buttons behave correctly anyway.

    What VCL Style did you use for the image you posted in post #5 of this thread ??? 

    JF

     

  • >>Can you confirm, as the image you posted earlier seems to show, that edits (simple, labelled and spin) in LMDTools 2014 do conform ??? <<
    As mentioned before, there are subtle differences (like the background color of edit controls). 

    >>What VCL Style did you use for the image you posted in post #5 of this thread ??? <<
    This was Aqua Light Slate as you mentioned in your first post.

Sign In or Register to comment.