- This topic has 2 replies, 2 voices, and was last updated 11 years, 10 months ago by DarrenB.
-
AuthorPosts
-
January 12, 2013 at 6:38 pm #35581DarrenBParticipant
Hi Serge,
as you know from my question and your answer
I learnt something new today!
I got to thinking about your answer and in it you showed me that I could do
sSpeedButton1.SkinData.SkinManager := sSkinManager1;
sSpeedButton2.SkinData.SkinManager := sSkinManager2;
I was wondering if it would be able to do this
sSpeedButton1.SkinData.SkinManager := sSkinManager[SpeedButton1MyIndex];
sSpeedButton2.SkinData.SkinManager := sSkinManager2[SpeedButton1MyIndex];
which would allow me to just change the SkinManager associated with a control by passing an index value.
Is this possible too? I went to try!!!
I tried a quick something like
Quote:I created a form with a SkinManager on it and set it to Blue Plastic, 3 TsPanels.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, sSkinManager, sSkinProvider, ExtCtrls, sPanel;
type
TForm1 = class(TForm)
sPanel1: TsPanel;
sPanel2: TsPanel;
sPanel3: TsPanel;
sSkinManager1: TsSkinManager;
sSkinProvider1: TsSkinProvider;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ManagerArray: array [1 .. 3] of TsSkinManager;
/// !!!!
/// / [1 .. 80] is possible????
MyProvider : TsSkinProvider;
/// /!!!!
/// [1 .. 80] is possible????
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
/// MyProvider:=TsSkinProvider.Create(form1); //// Proved Not Necessary???
ManagerArray[1] := TsSkinManager.Create(Form1);
ManagerArray[1].SkinDirectory :=
'C:UsersDarrenDownloadsAlphaSkins_814Skins';
ManagerArray[1].SkinName := 'Calcium';
ManagerArray[2] := TsSkinManager.Create(Form1);
ManagerArray[2].SkinDirectory :=
'C:UsersDarrenDownloadsAlphaSkins_814Skins';
ManagerArray[2].SkinName := 'AfterBurner';
ManagerArray[3] := TsSkinManager.Create(Form1);
ManagerArray[3].SkinDirectory :=
'C:UsersDarrenDownloadsAlphaSkins_814Skins';
ManagerArray[3].SkinName := 'Acryl';
sPanel1.SkinData.skinmanager := ManagerArray[1];
sPanel2.SkinData.skinmanager := ManagerArray[2];
sPanel3.SkinData.skinmanager := ManagerArray[3];
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
/// What Should I do here? Anything?
/// I don't know I get an access violation
/// MyProvider.Destroy; ????
/// ManagerArray[1].Destroy;
/// ManagerArray[2].Destroy;
/// ManagerArray[3].Destroy;
/// Do I need to destroy these or is it automatically handled?
end;
end.
When running the program I was delighted to get this
But I do not know if my method I tried is 'safe'. When I tried to destroy the skinmanagers … thinking it must be necessary… I get an access violation
What is the correct way to do this? Do I need to clean anything up to avoid memory leaks etc?
Obviously, .Destroy will be wrong in form.destroy, will
/// do clean up loop
ManagerArray[loopvalue].Free;
be enough?
If I chose to use this method are there anything I might have to learn to lookout for… any pitfalls as opposed to my 'normal' way of just placing them on a form? Would I need to do anything different? Other than setting properties myself? Will that method invalidate the need to create SkinProviders… I think I will need to create the dynamic SkinProvider too and associate it with a MyManager SkinManager so I can access it's properties too?
Just want to clear up a few initial questions before I try to add this new feature (new to me!) in my main app at a later date 🙂
Thanks again Serge
Darren
January 14, 2013 at 3:16 pm #49892SupportKeymasterSuch using is correct, but destroying should be automatic, why you do that?
Maybe one component is destroyed twice in your project?
January 14, 2013 at 6:12 pm #49895DarrenBParticipant'Support' wrote:Such using is correct, but destroying should be automatic, why you do that?
Maybe one component is destroyed twice in your project?
Hi Serge 🙂
no I don't actually use this method in my project… am currently just thinking about how I could use it and if I should. Just checking out what I should know beforehand 🙂
Was wondering if it was different to my normal method of just placing a single SkinManager on the main form and letting it be destroyed automatically.
Got my answer, thankyou 🙂
Darren
-
AuthorPosts
- You must be logged in to reply to this topic.