Page 1 of 1

Clearing selected Components programatically

Posted: Thu Jan 13, 2011 10:40 pm
by dcleyne

Folks,

I have an embedded Designer control. In response to various events in my application I want to be able to disable the Designer control so the user cannot make any further changes.

It works fine just by setting the Enabled property to false on the designer control. However, if there are any components selected on the page then they remain selected (even though you can't do anything with them). I would like to be able to deselect all of the selected components before I disable the control.

I can't find any obvious way to do this. Is there a way to do it?

Cheers,
Dan

Clearing selected Components programatically

Posted: Mon Jan 17, 2011 1:40 am
by Alex K.
Hello,

We couldn't reproduce this bug. Could you explain your issue in more details?
Can you please send us a simple test project, which reproduce the issue?

Thank you.

Clearing selected Components programatically

Posted: Tue Jan 18, 2011 3:28 pm
by dcleyne

I have a small sample project to send to you. How do I upload it?

Cheers,
Dan

Clearing selected Components programatically

Posted: Tue Jan 18, 2011 3:35 pm
by dcleyne
Hi,

I have a small sample project created in VS2008. You will need to add the Stimulsoft libs into the lib directory. I had to take them out to get the attachment to upload.

Run the application and open the report included in the zip file.

Select any component on the page in the report designer.

Disable the report designer by clicking on the "Enabled" checkbox

Note that the component previously selected is still selected, even thought the report designer is disabled.

Cheers,
Dan

Clearing selected Components programatically

Posted: Thu Jan 20, 2011 1:29 am
by Alex K.
Hello,

You can use the following code:

Code: Select all

private void checkBoxEnableDesigner_CheckedChanged(object sender, EventArgs e)
{
    StiReport report = stiDesignerControl1.Report;
    foreach (StiComponent component in report.Pages[0].Components)
    {
        component.IsSelected = false;
    }
    stiDesignerControl1.Refresh();
    stiDesignerControl1.Enabled = checkBoxEnableDesigner.Checked;
}
Thank you.

Clearing selected Components programatically

Posted: Thu Jan 20, 2011 5:31 pm
by dcleyne
Thank you!

Clearing selected Components programatically

Posted: Fri Jan 21, 2011 12:01 am
by Andrew
We are always glad to help you.