No skin on Modal Form but locks Parent Form when closed

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #35328
    Milli
    Participant

    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.

    #48839
    Hamilton
    Participant

    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

    #48840
    Hamilton
    Participant

    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.

    #48846
    Milli
    Participant

    Hey 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

    #48847
    Milli
    Participant

    Hey 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.

    #48855
    Hamilton
    Participant

    My pleasure Milli, glad I could be of help 🙂

    Serge: can you repro the issue with the -98 flag?

    Regards,

    Hamilton

    #48917
    Support
    Keymaster
    'Hamilton' wrote:
    Serge: can you repro the issue with the -98 flag?

    No, sorry, I can't reproduce it.

    #48944
    Hamilton
    Participant

    Hi 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

    #49053
    Support
    Keymaster

    Hello!

    Yes, this tag value is working for standard and thirdparty controls only.

    Also this tag working on forms where TsSkinProvider does not exists.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.