- This topic has 8 replies, 3 voices, and was last updated 12 years, 1 month ago by Support.
-
AuthorPosts
-
August 27, 2012 at 2:57 am #35328MilliParticipant
In my main form I am opening a second form Modally and don't want this second Form to have a skin.
This is the method I am using to open the second form from within my MainForm:
procedure TFormMain.stbsht2ClickBtn(Sender: TObject);
begin
SecondForm := TSecondForm.Create(Application);
SecondForm.ShowModal;
SecondForm.Free;
end;
In the second Form, when the form opens, I disable the SkinManager on the Main Form which I have read somewhere else on this forum is the correct way to not skin a Modal Form. This works, but when I close the Modal form, all the AlphaControl Components lock. The Non-Alpha components work fine. I am using AlphaControls v7.68. These are the methods in the secondform which when opened, disables the Main Form's skinmanager and when closed, enables it again:
//disabling the skinmanager in Main Form – works well
procedure TSecondForm.FormShow(Sender: TObject);
begin
sSkinProvider1.SkinData.SkinManager.Active := False;
end;
//Enabling the the skinmanager in Main Form – works but all AlphaControl components are locked, i.e; they do not respond to any clicking or tabbing, etc.
procedure TSecondForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
sSkinProvider1.SkinData.SkinManager.Active := True;
end;
Your prompt help with this issue would be much appreciated as I have tried to implement this for a few days now and I am inclined to think that this is a bug within AlphaControls.
August 27, 2012 at 3:57 am #48839HamiltonParticipantHi Milli,
I cannot repro this fault using AC768 in Delphi 2010. I set up a sample app as you suggested and it worked fine – but I have huge reservations about the way you've implemented this and aren't surprised that there might be issues because the flow control you've setup is telling the SkinManager to skin Form2 just as it is being closed – which should probably work in theory but is courting problems because it will just take one control with incorrect state flags to cause an AV, and also because it will cause the main form to be non skinned which is not what you intend from what I understand.
I think the recommended approach is to set the form tag to -98. However, I just tested this also and it doesn't work for me. If I set the tag for Form2 to -98 then it and it's controls are still skinned. Ideally this would be fixed.
Serge: can you look into this please? The -98 tag doesn't seem to turn off skinning for a form OR control, at least not as I've understood it should work from your post [topic='7111']7111[/topic]
What I think you should perhaps try is to move the SkinManager control logic off the sub form and onto the main form, like this:
NOTE: I couldn't help but add a try..finally loop for the create/destroy flow and replaced Form.Free with Form.Release as is recommended in the Delphi help.
Code:procedure TFormMain.stbsht2ClickBtn(Sender: TObject);
begin
try
SkinManager.Active := False;
SecondForm := TSecondForm.Create(nil);
SecondForm.ShowModal;
finally
SecondForm.Release;
SkinManager.Active := True;
end;
end;Good luck!
Regards,
Hamilton
August 27, 2012 at 4:08 am #48840HamiltonParticipantThe alternative fix suggested in thread [topic='7111']7111[/topic] is:
* change the sSkinManager1.SkinningRules.srStdForms property to False.
* place a TsSkinProvider component on each form which should be skinned.
August 28, 2012 at 8:42 pm #48846MilliParticipantHey Hamilton.
Thank you very much for the reply and also for adding in the try…finally statement. I did as you suggested below and all the AlphaControls components still lock on the Main Form when I close the SecondForm.
I am using Delphi XE2 as my IDE so maybe this is why you can't reproduce it with Delphi 2010.
I will try the alternative fix suggested in thread 7111 and let you know how I get along.
Thanks once again for your help Hamilton, it is highly appreciated.
Milli
'Hamilton' wrote:Hi Milli,
I cannot repro this fault using AC768 in Delphi 2010. I set up a sample app as you suggested and it worked fine – but I have huge reservations about the way you've implemented this and aren't surprised that there might be issues because the flow control you've setup is telling the SkinManager to skin Form2 just as it is being closed – which should probably work in theory but is courting problems because it will just take one control with incorrect state flags to cause an AV, and also because it will cause the main form to be non skinned which is not what you intend from what I understand.
I think the recommended approach is to set the form tag to -98. However, I just tested this also and it doesn't work for me. If I set the tag for Form2 to -98 then it and it's controls are still skinned. Ideally this would be fixed.
Serge: can you look into this please? The -98 tag doesn't seem to turn off skinning for a form OR control, at least not as I've understood it should work from your post [topic='7111']7111[/topic]
What I think you should perhaps try is to move the SkinManager control logic off the sub form and onto the main form, like this:
NOTE: I couldn't help but add a try..finally loop for the create/destroy flow and replaced Form.Free with Form.Release as is recommended in the Delphi help.
Code:procedure TFormMain.stbsht2ClickBtn(Sender: TObject);
begin
try
SkinManager.Active := False;
SecondForm := TSecondForm.Create(nil);
SecondForm.ShowModal;
finally
SecondForm.Release;
SkinManager.Active := True;
end;
end;Good luck!
Regards,
Hamilton
August 28, 2012 at 8:54 pm #48847MilliParticipantHey Hamilton
Alternate Fix no.1 on Thread 7111 works like a charm with AlphaControls 7.68 and Delphi XE2.
Thanks once again for your help.
Milli
'Hamilton' wrote:The alternative fix suggested in thread [topic='7111']7111[/topic] is:
* change the sSkinManager1.SkinningRules.srStdForms property to False.
* place a TsSkinProvider component on each form which should be skinned.
September 4, 2012 at 3:41 am #48855HamiltonParticipantMy pleasure Milli, glad I could be of help 🙂
Serge: can you repro the issue with the -98 flag?
Regards,
Hamilton
September 10, 2012 at 3:49 pm #48917SupportKeymaster'Hamilton' wrote:Serge: can you repro the issue with the -98 flag?No, sorry, I can't reproduce it.
September 13, 2012 at 1:59 am #48944HamiltonParticipantHi Serge,
Can you explain to me how the form tag should work in this case? If I put a skin manager and provider on a form and set the form tag to -98 then the form is always skinned. Is this what you would expect?
I had previously thought that the -98 tag worked on all controls but I reread your post in thread 7111 and realized that you had stated it only works with standard (non AC) controls. Now that I understand that I can see it works as expected with controls; if I put a TButton on the same form, add TButton to the 3rd party list and then set it's tag to -98 then the button is not skinned but if I do the same thing with a TsButton it is still skinned, which is fine.
Regards,
Hamilton
October 1, 2012 at 9:01 am #49053SupportKeymasterHello!
Yes, this tag value is working for standard and thirdparty controls only.
Also this tag working on forms where TsSkinProvider does not exists.
-
AuthorPosts
- You must be logged in to reply to this topic.