Title For Model Dialog

Topics: CAB & Smart Client Software Factory
Jul 8, 2006 at 9:43 AM
originally posted by: ramyrams

I need to give the title and set its position for a modal window which is called in a button click of an view.

I have a button in a view, that calls the another view as Modal dialog. Nowhere I see the property to set the title and its X and Y position. Where to set this properties.

Protected Overrides Sub OnRunStarted()
MyBase.OnRunStarted()
Try
Dim MainWorkspace As UltraDockWorkspace = Me.RootWorkItem.Workspaces.Get(Of UltraDockWorkspace)("ultraDockWorkspace1")
Dim view As ReAssignView = Me.Items.AddNew(Of ReAssignView)()
Me.Workspaces(Constants.WorkspaceNames.SHELL_MODAL).Show(view)
Catch ex As Exception
ExceptionHandler.Instance.ProcessTrappedException(ex)
End Try

End Sub
Jul 8, 2006 at 10:04 AM
originally posted by: ChrisHolmes

I'm assuming that you have a WindowWorkspace somewhere and that your call to Constants.WorkspaceNames.SHELL_MODAL is such a Workspace.

What you need to do is provide a WindowSmartPartInfo for it, like so:

WindowWorkspace workspace = new WindowWorkspace(this);
WindowSmartPartInfo info = new WindowSmartPartInfo();
info.Title = "My Modal Dialog";
info.Location = new Point(500, 500);

View myView = new View();
workspace.show(myView);
workspace.ApplySmartPartInfo(view, info);

That will give your modal window a Title and Location. There's also a few other properties you can set with the WindowSmartPartInfo such as the Modality of the window.

Finally: What is that first call to the UlraDockWorkspace doing? It appears that you fetch that Workspace, but then you don't use it. Superfluous code?

Hope this helps.
Jul 8, 2006 at 11:20 AM
originally posted by: ramyrams

Thanks ChrisHolmes, It working fine as I expected. Yes I need to remove Superfluous codes, It just a testing code. Thanks for the points.