- This topic has 8 replies, 3 voices, and was last updated 13 years, 1 month ago by Hamilton.
-
AuthorPosts
-
September 17, 2011 at 4:21 pm #34784azrael11Participant
i have this procedure…
Code:Procedure StartSkinEngine;
var
i: Integer;
skinnames: TStringList;
Begin
Conf.skinM.SkinDirectory := Program_Path+'mediaconfeditorskins';
SkinNames := TStringList.Create;
Conf.SkinM.SkinName := Conf.SkinM.GetSkinNames(SkinNames);
Conf.sLB_ce_themes.Items.Clear;
for i := 0 to skinnames.Count -1 do
Conf.sLB_ce_themes.Items.Add(SkinNames);
i := ConfIni.ReadInteger('Themes','Theme',i);
Conf.sLB_ce_themes.Selected := true;
Conf.sLabelFX3.Caption := Conf.sLB_ce_themes.Items.Strings;
Conf.img_ce_theme.Picture.LoadFromFile('mediaconfeditorskinspreview'+conf.sLB_ce_themes.items.strings+'.png');
ThemeCreator(i+1);
SetAllCursor(i+1);
GroupBoxColors(i);
conf.skinM.SkinName := Conf.sLB_ce_themes.Items.Strings;
Conf.skinM.Active := True;
Application.ProcessMessages;
skinnames.Free;
end;I run it to my project everything is ok BUT
When i try to use the SelectDirectory from FileCtrl then i get a strange error that “EstringList.error List index out of bounds(0)”;
i remove the procedure so i setup no theme the SelectDirectory WORKS PERFECT so
HELP….
September 20, 2011 at 8:00 am #46718SupportKeymasterHello
I think, you should debug this code more.
The “i” variable can have incorrect value here…
This topic will be moved in “Troubleshooting” part.
September 20, 2011 at 1:09 pm #46722azrael11Participant'Support' wrote:Hello
I think, you should debug this code more.
The “i” variable can have incorrect value here…
This topic will be moved in “Troubleshooting” part.
I dubug the code and i found nothing other than this…
When i make active the skinm i get the above error…
I change the i variable to other name like xxxmmmkkk but nothing changes….
Try difernet skins nothing changes…
Please help… this keeps my project back….
Thank you….
September 21, 2011 at 5:38 am #46729SupportKeymaster'azrael11' wrote:i := ConfIni.ReadInteger('Themes','Theme',i);What is value of “i” here? You should check it.
Quote:Conf.sLB_ce_themes.Selected := true;Error may be occurred here if “i” is out of range.
Quote:Conf.sLabelFX3.Caption := Conf.sLB_ce_themes.Items.Strings;“i” should be bigger or equal 0 and smaller than Conf.sLB_ce_themes.Items.Strings.Count
And sLB_ce_themes is ListBox? Maybe you should write Conf.sLB_ce_themes.Items?
Quote:ThemeCreator(i+1);SetAllCursor(i+1);
I don't know what is that, but why “i + 1”?
You should check all this code?
What is number of line with “Out of range” error?
September 21, 2011 at 9:27 pm #46741azrael11ParticipantCode:Procedure StartSkinEngine;
var
skinnames: TStringList;
rec : TSearchRec;
themeName: string;
Begin
Conf.skinM.SkinDirectory := Program_Path+'mediaconfeditorskins';
SkinNames := TStringList.Create;
Conf.SkinM.SkinName := Conf.SkinM.GetSkinNames(SkinNames);
Conf.sLB_ce_themes.Items.Clear;
if FindFirst(Conf.SkinM.SkinDirectory+'*.*' , faAnyFile, Rec) = 0 then
begin
repeat
if ((Rec.Attr and faDirectory) <> faDirectory) then
begin
themeName := Trim(Copy(rec.Name,0,Length(rec.Name)-4));
Conf.sLB_ce_themes.Items.Add(themeName);
end;
until FindNext(Rec) <> 0;
end;
Conf.SkinM.SkinName := 'creamy_velvet';
Conf.skinM.Active := True;
Application.ProcessMessages;
skinnames.Free;
end;Ok here is more simple code i wrote again the same above problem…
Now i am not using any integer variable so that envolves something…
I update to the last version (the stable) but the problem remains…
If i make Conf.skinM.active := False; everything works ok…
If I make it true everything works ok exept the selectdirectory funtion that gives me the above error…
help…
p.s.
The ThemeCreator(i+1) is just give the creator name and the skin name in alabel…
The SetAllCursor(i+1) just strats the animated cursors engine…
September 25, 2011 at 2:27 am #46747azrael11ParticipantPlease someone help i really stuck here…
September 26, 2011 at 1:57 am #46749HamiltonParticipantHi Azrael,
You say the code raised an exception on 'selectdirectory' but that method is not called in your code. Regardless, I did try to run your code and apart from a couple of minor changes to get it working in a test environment everything seemed OK. Can you please try the following:
1. Create a new application
2. Add a tsbutton, align to bottom
3. Add a tsmemo, align to client
4. Add an OnClick event to the button and call the slightly modified StartSkinEngine procedure I've posted below. I made some slight changes to your code to get it to work in this scenario but nothing that affects the operation.
For me, the code ran successfully and caused the memo to be modified to contain the list of all skins in my skin folder and it set the skin to the one I'd requested.
If this doesn't work then there is something about your environment I'd guess. I didn't experiment what would happen if the skin folder had hidden files or folders but you could try something like searching for 'faAnyFile – faDirectory' insead of 'faAnyFile'. Also if you find your code works in the test app but doesn't in your project then something else to consider might be to change your file IO methods to explicitly call SysUtils, for example SysUtils.FindFirst, to avoid type mismatches with functions of the same name in other libraries (i've had this happen before, its obscure but maybe the wrong function is being called).
Anyway good luck I hope you get it sorted soon.
Procedure TForm1.StartSkinEngine;
var
skinnames: TStringList;
rec : TSearchRec;
themeName: string;
Begin
sSkinManager1.SkinDirectory := 'C:Delphi AddonsAlphaControlsSkins';
// sSkinManager1.SkinDirectory := ExtractFilePath(Application.ExeName) + 'mediaconfeditorskins';
SkinNames := TStringList.Create;
sSkinManager1.SkinName := sSkinManager1.GetSkinNames(SkinNames);
sMemo1.Lines.Clear;
if FindFirst(sSkinManager1.SkinDirectory+'*.*' , faAnyFile, Rec) = 0 then
begin
repeat
if ((Rec.Attr and faDirectory) <> faDirectory) then
begin
themeName := Trim(Copy(rec.Name,0,Length(rec.Name)-4));
sMemo1.Lines.Add(themeName);
end;
until FindNext(Rec) <> 0;
end;
sSkinManager1.SkinName := 'darkglass';
sSkinManager1.Active := True;
Application.ProcessMessages;
skinnames.Free;
end;
September 28, 2011 at 2:32 am #46757azrael11Participant'Hamilton' wrote:Also if you find your code works in the test app but doesn't in your project then something else to consider might be to change your file IO methods to explicitly call SysUtils, for example SysUtils.FindFirst, to avoid type mismatches with functions of the same name in other libraries (i've had this happen before, its obscure but maybe the wrong function is being called).Thank you my friend this is it… 😉 at last…
I change the findfirst with sysutils.findfirst as you suggest and everything works great…
Now a small question how can i track this problem… the source code consists from 30 units and a 30.000 lines of code… any tool to track it or anything else
September 28, 2011 at 3:02 am #46758HamiltonParticipantGlad I could help 🙂 I'm not sure I understand your additional question but I think you'll just want to search for occurrences of FindFirst and FindNext throughout your project and change them all to SysUtils.FindFirst and SysUtils.FindNext. Best of luck.
-
AuthorPosts
- You must be logged in to reply to this topic.