Clearing selected Components programatically

Stimulsoft Reports.NET discussion
Post Reply
dcleyne
Posts: 10
Joined: Wed Aug 18, 2010 9:12 pm
Location: Melbourne

Clearing selected Components programatically

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Clearing selected Components programatically

Post 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.
dcleyne
Posts: 10
Joined: Wed Aug 18, 2010 9:12 pm
Location: Melbourne

Clearing selected Components programatically

Post by dcleyne »


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

Cheers,
Dan
dcleyne
Posts: 10
Joined: Wed Aug 18, 2010 9:12 pm
Location: Melbourne

Clearing selected Components programatically

Post 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
Attachments
799.DisableDesignerTest.zip
(15.8 KiB) Downloaded 270 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Clearing selected Components programatically

Post 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.
dcleyne
Posts: 10
Joined: Wed Aug 18, 2010 9:12 pm
Location: Melbourne

Clearing selected Components programatically

Post by dcleyne »

Thank you!
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Clearing selected Components programatically

Post by Andrew »

We are always glad to help you.
Post Reply