Page 1 of 1

Can't get Toolbars...

Posted: Mon May 19, 2008 7:37 am
by Neo77
Hi

I'm using the following code to initialize a StiDesignerControl which is placed on a UserControl:

Code: Select all

StiService[] services = StiToolbarService.GetToolbarServices(stiDesigner);
				foreach (StiToolbarService tbservice in services)
				{
					if (tbservice.ToolBar != null)
					{
						tbservice.ToolBar.Visible = true;
						tbservice.ServiceEnabled = true;
					}
				}

				StiOptions.Designer.CodeTabVisible = false;
				StiOptions.Designer.ShowDesignerControlMainMenu = false;

				StiDesignerControl.DontSaveDesignerConfig = true;
				StiDesignerControl.DontSaveDockingPanelsConfig = true;
				StiDesignerControl.DontSaveEditorConfig = true;
				StiDesignerControl.DontAskSaveReport = true;
				StiDesignerControl.CanDesignerChangeReportFileName = false;

				StiDesignerControl.SavingReport += new StiSavingObjectEventHandler(StiDesigner_SavingReport);

				StiStandardToolbarService service = StiStandardToolbarService.GetService(stiDesigner);
				service.ShowReportNew = false;
				service.ShowReportOpen = false;
				service.ShowClose = false;

				stiDesigner.RefreshToolbars();
				stiDesigner.InvokeOrderToolbars();				

				_IsDesignerInitialized = true;
			}

None of the toolbars will show (even they are set to visible=true if I ste through the code).
The only way to display the toolbars in my application is to start the Designer and add the toolbars manually.

I'm using Version 2008.1.200 from 10 March 2008.

Many thanks for your help!
Chris

Can't get Toolbars...

Posted: Wed May 21, 2008 6:25 am
by Neo77
Anyone please...?

Can't get Toolbars...

Posted: Wed May 21, 2008 8:34 am
by Vital
Hello Chris,

Please use following code if your designer already loaded:

Code: Select all

StiService[] services = StiToolbarService.GetToolbarServices(stiDesigner);
				foreach (StiToolbarService tbservice in services)
				{
					if (tbservice.ToolBar != null)
					{
						tbservice.ToolBar.Visible = true;
						tbservice.ToolBar.PlaceOnControl();

					}
				}
StiDesignerConfigService designerConfig = Services.GetService(typeof(StiDesignerConfigService)) as StiDesignerConfigService;
designerConfig.Save();
[/quote]

Can't get Toolbars...

Posted: Thu May 22, 2008 1:21 am
by Neo77
Hi,

Thanks for your reply. I get an NullReferenceException on the line:

Code: Select all

tbservice.ToolBar.PlaceOnControl();
This is my complete code (also tried to place your code before assigning my report to the designer):

Code: Select all

StiReport stiReport = new StiReport();
				stiReport.Load(_Report.ReportObject.BinaryData);

				DataSet set = AgendaItemManager.GetAllAgendaItemsDataTable(ViaContext, _Report.Ou, null, null);
				
				stiReport.RegData(set);
				stiDesigner.Report = stiReport;

				StiService[] services = StiToolbarService.GetToolbarServices(stiDesigner);
				foreach (StiToolbarService tbservice in services)
				{
					if (tbservice.ToolBar != null)
					{
						tbservice.ToolBar.Visible = true;
						tbservice.ToolBar.PlaceOnControl();

					}
				}
				StiDesignerConfigService designerConfig = Stimulsoft.Report.StiConfig.Services.GetService(typeof(StiDesignerConfigService)) as StiDesignerConfigService;
				designerConfig.Save();
Stacktrace:
bei Stimulsoft.Controls.StiToolBar.PlaceOnControl()
bei srgits.Via.Desktop.AdminModule.Controls.ReportUserControl.UpdateView() in D:\win\VIA\Source\DesktopApp\Modules\Via.Desktop.AdminModule\Controls\ReportUserControl.cs:Zeile 142.
bei srgits.Via.Desktop.AdminModule.Controls.ReportUserControl.SetContext(Report report) in D:\win\VIA\Source\DesktopApp\Modules\Via.Desktop.AdminModule\Controls\ReportUserControl.cs:Zeile 67.
bei srgits.Via.Desktop.AdminModule.ModuleWorkItem.ExplorerView_AfterSelect(Object sender, TreeViewEventArgs e) in D:\win\VIA\Source\DesktopApp\Modules\Via.Desktop.AdminModule\ModuleWorkItem.cs:Zeile 212.
bei srgits.Via.Desktop.AdminModule.Views.ExplorerSmartPart.tvwTools_AfterSelect(Object sender, TreeViewEventArgs e) in D:\win\VIA\Source\DesktopApp\Modules\Via.Desktop.AdminModule\Views\ExplorerSmartPart.cs:Zeile 397.
bei System.Windows.Forms.TreeView.OnAfterSelect(TreeViewEventArgs e)
bei System.Windows.Forms.TreeView.TvnSelected(NMTREEVIEW* nmtv)
bei System.Windows.Forms.TreeView.WmNotify(Message& m)
bei System.Windows.Forms.TreeView.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
bei System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
bei System.Windows.Forms.Control.WmNotify(Message& m)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)
bei System.Windows.Forms.ContainerControl.WndProc(Message& m)
bei System.Windows.Forms.UserControl.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
bei System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
bei System.Windows.Forms.Control.DefWndProc(Message& m)
bei System.Windows.Forms.TreeView.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.TreeView.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(Form mainForm)
bei Microsoft.Practices.CompositeUI.WinForms.FormShellApplication`2.Start() in D:\win\VIA\Source\Library\CompositeUI.WinForms\FormShellApplication.cs:Zeile 31.
bei Microsoft.Practices.CompositeUI.CabApplication`1.Run() in D:\win\VIA\Source\Library\CompositeUI\CabApplication.cs:Zeile 81.
bei Via.DesktopShell.Program.Main() in D:\win\VIA\Source\DesktopApp\Via.DesktopShell\Program.cs:Zeile 143.
bei System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()

Can't get Toolbars...

Posted: Thu May 22, 2008 6:16 am
by Edward
The issue is confirmed.

We'll inform you when the solution is ready.

Thank you.

Can't get Toolbars...

Posted: Thu May 29, 2008 4:59 pm
by Vital
Hello,

Please use following code:

Code: Select all

tbservice.ToolBar.Visible = true;
if (tbservice.ToolBar.Parent == null)
         stiDesignerControl1.pnToolbox.Controls.Add(tbservice.ToolBar);
tbservice.ToolBar.PlaceOnControl();
Thank you.

Can't get Toolbars...

Posted: Wed Jun 11, 2008 9:18 am
by Neo77
Hi,

I'm using the following code (an version SR_2008.06.03_R2005) but still got now luck (and no toolbars)...

Code: Select all

StiReport.ClearImageCache();
				StiReport.ClearReportCache();

				StiStandardToolbarService service = StiStandardToolbarService.GetService(stiDesigner);
				service.ShowReportNew = false;
				service.ShowReportOpen = false;
				service.ShowClose = false;
				service.ToolBar.Visible = true;

				if (service.ToolBar.Parent == null)
				{
					stiDesigner.pnToolbox.Controls.Add(service.ToolBar);
				}

				service.ToolBar.PlaceOnControl();

				StiOptions.Designer.CodeTabVisible = false;

				StiDesignerControl.DontSaveDesignerConfig = true;
				StiDesignerControl.DontSaveDockingPanelsConfig = true;
				StiDesignerControl.DontSaveEditorConfig = true;
				StiDesignerControl.DontAskSaveReport = true;
				StiDesignerControl.CanDesignerChangeReportFileName = false;

				StiDesignerControl.SavingReport += new StiSavingObjectEventHandler(StiDesigner_SavingReport);

				stiDesigner.RefreshToolbars();
				stiDesigner.InvokeOrderToolbars();				

				_IsDesignerInitialized = true;


Can't get Toolbars...

Posted: Mon Jun 23, 2008 3:53 am
by Vital
Hello,

Sorry your code is correct. Can you send small example with this problem?

Thank you.