Designer: i don't want to save "View" settings

Stimulsoft Reports.NET discussion
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Designer: i don't want to save "View" settings

Post by Fabio Pagano »

In designer, if user closes the dictionary (toggling "View / Dictionary"), this setting is "remembered" next time, so dictionary won't appear. I want to ignore this setting and i want to force to always show the dictionary panel. But i don't want to disable "View / Dictionary" (so that user can't toggle), i only want not to remember the setting so that dictionary panel will always be visible.

Thanks.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Designer: i don't want to save "View" settings

Post by Edward »

All settings of the Designer's layout are stored in the DockingPanels.config file. This file is located in the following path:

c:\Documents and Settings\"USER ACCOUNT NAME"\Local Settings\Application Data\Stimulsoft\

So changing of this settings allows you to remember visibility of the Dictionary.

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Designer: i don't want to save "View" settings

Post by Fabio Pagano »

If i have correctly understood, this doesn't answer to my question. I always want to show the dictionary panel, ignoring user last choice.

Thanks.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Designer: i don't want to save "View" settings

Post by Edward »

You can enable the Dictionary in runtime via the following code

Code: Select all

StiDictionaryPanelService dictionary = new StiDictionaryPanelService();
dictionary.Init(designer);
If necessary, we can add such an option for the report settings.

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Designer: i don't want to save "View" settings

Post by Fabio Pagano »

Edward wrote:You can enable the Dictionary in runtime via the following code

Code: Select all

StiDictionaryPanelService dictionary = new StiDictionaryPanelService();
dictionary.Init(designer);
If necessary, we can add such an option for the report settings.
Help me to understand. I don't use internal report code, so i do all settings from my vb.net program. So in my vb.net program i have tried the following:

Code: Select all

Dim DictionaryPanelService As Stimulsoft.Report.Design.Panels.StiDictionaryPanelService = Stimulsoft.Report.Design.Panels.StiDictionaryPanelService.GetService
DictionaryPanelService.Init(myReport.Designer)
but "Init" throws a nullreference exception (myReport.Designer is nothing).

So i assume that the code you have given was intended for internal report code. Instead, as above said, i need to make the dictionary always visible from my vb.net code.

Note that this is not a "must" in my application, it's only a "security behavior" so that if the user closes the dictionary panel, next time it appears anyway.

If, as you said, to "add an option for the report settings" means that i can do this from my code, to me it would be ok.

Thanks.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Designer: i don't want to save "View" settings

Post by Edward »

Please place this code in the LoadingEvent of the main form in your application.

Code: Select all

AddHandler StiDesigner.LoadingDesigner, New EventHandler(AddressOf Me.StiDesigner_LoadingDesigner)
Also please define a method, as following:

Code: Select all

Private Sub StiDesigner_LoadingDesigner(ByVal sender As Object, ByVal e As EventArgs)
    New StiDictionaryPanelService().Init(TryCast(sender,StiDesigner))
End Sub
After that the designer will be always visible even if the user closes it in the previous run.

Thank you.



Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Designer: i don't want to save "View" settings

Post by Edward »

The null reference exception occurs when designer is not created. It is the reason I think in your code.

We've added StiDesigner.LoadedDesigner static event in the build from August, 22. So tomorrow you will be able to download it.

Please see the code which guarantees that Dictionary always be visible even if the user closes the dictionary in the previous session.

Please add the following command to your Application when it is executed only once, e.g. in the Load event of the main form in your application:

Code: Select all

   AddHandler StiDesigner.LoadedDesigner, New EventHandler(AddressOf Me.StiDesigner_LoadedDesigner)
Also please define the following method:

Code: Select all

Private Sub StiDesigner_LoadedDesigner(ByVal sender As Object, ByVal e As EventArgs)
    Dim dockingPanel As StiDockingPanel
    Dim designer As StiDesigner = TryCast(sender,StiDesigner)

    Dim serviceDictionary As StiPanelService = StiDictionaryPanelService.GetService(designer)
    If Not serviceDictionary.DockingControl.IsVisible Then
        designer.DockingManager.ClosedControls.Remove(serviceDictionary.DockingControl)
        dockingPanel = New StiDockingPanel(designer.DockingManager)
        dockingPanel.Controls.Add(serviceDictionary.DockingControl)
        dockingPanel.DockPanelToForm(designer, serviceDictionary.DockStyle)
    End If
End Sub
Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Designer: i don't want to save "View" settings

Post by Fabio Pagano »

Sorry, i don't find in what namespace is "StiDockingPanel".

Thanks.
Guest
Posts: 182
Joined: Tue Jun 06, 2006 8:04 am

Designer: i don't want to save "View" settings

Post by Guest »

StiDockingPanel is placed in the "Stimulsoft.Controls" namespace.

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Designer: i don't want to save "View" settings

Post by Fabio Pagano »

I'm resuming this thread because now i'm converting from version 2008.2.247.0 of 03/06/2008 to version 2008.3.311.0 of 19/11/2008.

I have the following code to always show the dictionary panel in designer, and it worked with 2008.2.247.0 version:

Code: Select all

Private Sub StiDesigner_LoadedDesigner(ByVal sender As Object, ByVal e As EventArgs)

Dim dockingPanel As Stimulsoft.Controls.StiDockingPanel
Dim designer As Stimulsoft.Report.Design.StiDesigner = TryCast(sender, Stimulsoft.Report.Design.StiDesigner)

Dim serviceDictionary As Stimulsoft.Report.Design.Panels.StiPanelService = Stimulsoft.Report.Design.Panels.StiDictionaryPanelService.GetService(designer)
If Not serviceDictionary.DockingControl.IsVisible Then
   designer.DockingManager.ClosedControls.Remove(serviceDictionary.DockingControl)
   dockingPanel = New Stimulsoft.Controls.StiDockingPanel(designer.DockingManager)
   dockingPanel.Controls.Add(serviceDictionary.DockingControl)
   dockingPanel.DockPanelToForm(designer, serviceDictionary.DockStyle)
End If

End Sub

With 2008.3.311.0 version i have some errors, example:

Dim serviceDictionary As Stimulsoft.Report.Design.Panels.StiPanelService = Stimulsoft.Report.Design.Panels.StiDictionaryPanelService.GetService(designer)
gives
"Value of type 'Stimulsoft.Report.Design.StiDesigner' cannot be converted to 'Stimulsoft.Report.Design.StiDesignerControl'

How can i, in version 2008.3.311.0, always show the Dictionary panel in the designer?

Thank you.
Post Reply