Current filter:
                                You should refresh the page.
                                  • Hi there,

                                    I have a "MDI" interface with a main form at the highest level; this then uses the document manager to house 2 more levels of user controls
                                    (ie main form contains XtraUserControLevel1, then XtraUserControLevel1 contains XtraUserControLevel2).

                                    How do I use an Overlay form to only block a new "tab" of XtraUserControLevel1?
                                    ie exception of "Handle" is thrown when I do SplashScreenManager.ShowOverlayForm(this ...

                                    However, if i pass the main form's handle all the way down to XtraUserControLevel2, then I'm able to block - but obviously it'd block all tabs instead of blocking each tab.

                                    And - I don't think I can house a form within another form.

                                    So in this overlay-form-for-tabbed-documents, what is the answer for that "control"?
                                    btw, the documentation could provide better details than just stating
                                    "You can only show an Overlay Form over a control/form that has a handle (see System.Windows.Forms.Control.IsHandleCreated). Otherwise, an exception is thrown. "

                                    Thanks!

                                Show all comments
                                • Sasha (DevExpress Support) 11.11.2019

                                  Hi,

                                  >>>So in this overlay-form-for-tabbed-documents, what is the answer for that "control"?
                                  You need to pass the control over which you need to show your form. If you wish to block only the XtraUserControLevel1 control - pass it to the ShowOverlayForm method. An exception can be thrown if a control's handle is not created. You can check it using a control's IsHandleCreated property. I also created a small sample project that illustrates how to show an overlay form over a tab and close it.

                                  >>>btw, the documentation could provide better details than just stating
                                  "You can only show an Overlay Form over a control/form that has a handle (see System.Windows.Forms.Control.IsHandleCreated). Otherwise, an exception is thrown.  "

                                  Thank you for your feedback. We will consider updating this article.

                                • TheGrunt 11.12.2019

                                  Hi Sasha,

                                  the main issue with IsHandleCreated is that it doesn't solve the issue readily.
                                  The use of this in the aforementioned context -
                                  Main Form is supposed to be an MDI - ie one form doesn't block the other.
                                  In the initial MainForm_Load, it will create a default/user-preferred start "widget" - ie usercontrol of usercontrol.
                                  ie something like this -
                                  documentManagerMain.View.AddDocument(docContent.AccessibleName, docContent.Name)
                                  where docContent is the usercontrol of usercontrol

                                  Some of these usercontrols takes upwards of 10 seconds to load data; therefore to prevent a catch 22

                                  1. I'd need to always invoke the AddDocument expecting it to just setup the usercontrols with empty content - so that the handle is created
                                  2. I'd also need to pass an event delegate from the MainForm to the spawed usercontrol - so that when the MainForm raises MainForm_LoadCompleted, the spawned usercontrol will know that its handle is probably created and it can show start the async task of showing the overlay form and loading data.

                                  Would you please suggest if this is the best method to use the document manager?

                                  btw in your example, clicking on document 2 tab cancels the overlay form.  I modified it to fire from the a new barEditItem (ie you created Show Overlay Form and I added Close Overlay Form).
                                  So,

                                  1. click on document 1 tab,

                                  2. click on Show Overlay Form button
                                  (Overlay Form blocks document1)

                                  3. Now if I were to click on document2 and move it anywhere, I would expect document1's overlay form to still stay on - but it disappeared.

                                • Sasha (DevExpress Support) 11.13.2019

                                  Hi,

                                  From what I gather, you wish to make sure that a control's handle is created to show an overlay form. If so, you can handle the control's HandleCreated or Load event. You can also use the Deferred Load feature and handle the BaseView.QueryControl event to provide the document's content. This event is raised when a document is activated and allows you to provide documents' content dynamically.

                                  I've also modified your sample project to show the overlay form when a document is activated based on a condition. Please review it and let me know if it helps.

                                • TheGrunt 11.13.2019

                                  Hi Sasha,

                                  Couldn't find the HandleCreated event; I've moved some methods off to the Load event and it now fires better.
                                  However, there's still a persistent issue;
                                  the userControl of userControl doesn't show at all, although the async task is clearly executing in the background.

                                  So to recap - mainForm instantiates a userControlA, that userControlA instances 2 other userControlsB.

                                  userControlA was added like this
                                  System.Windows.Forms.Control docContent = Document.GetDocumentContent(dataCache);
                                  documentManagerMain.View.AddDocument(docContent.AccessibleName, docContent.Name);

                                  and it runs this before it runs the async task
                                                  IOverlaySplashScreenHandle overlayHandle =
                                                      SplashScreenManager.ShowOverlayForm(
                                                              this,
                                                              customPainter: new OverlayWindowCompositePainter(_taskOverlayMainText));

                                  where this => itself.

                                  There are 2 ways that this overlayform will show;

                                  1. change this to this's Parent form's handle (which I don't want to, because it blocks the entire form, while I just wanted the overlay to block itself until it's completed loading)

                                  2. Click on the parent form's handle and move/resize it (by default it's maximized) - this triggers something that displays the overlay form.
                                  I've tried everything from this.Activate/Refresh, this.ParentForm.Activate/Refresh, changing the window state - but none of this reproduces the physical handling of the parent form.
                                  Any ideas?

                                • Sasha (DevExpress Support) 11.14.2019

                                  Hi,

                                  Thank you for the clarification. Based on your description, the issue may occur since a control is not yet visible when you show the overlay form and its location is changed after it was shown. Would you please try calling the ShowOverlayForm method with a small delay using the BeginInvoke method? If this approach doesn't help, modify my sample or provide me with your own sample project where the issue is reproducible.

                                  I look forward to your results.

                                • TheGrunt 11.14.2019

                                  Hi Sasha,

                                  1. Not sure how I'd use the BeginInvoke method because I'm using the factory pattern
                                  2. Sample as attached.

                                  I've commented within XtraUserControl1.cs's LoadData() method;
                                  so essentially - if ShowOverlayForm is passed with this (or this.textBox1), then the overlay form doesn't appear. OTOH, it appears if we use the parentForm's handle.
                                  Would appreciate suggestions on how to make this work under the given context - the actual solution is massive and I wouldn't want to make a drastic change.  Thanks.

                                • Sasha (DevExpress Support) 11.15.2019

                                  Hi,

                                  Thank you for the sample project. To avoid this issue, I suggest that you override the OnPaint method and call the LoadData method there:

                                  [C#]
                                  bool isFormVisible; protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if(IsHandleCreated && !isFormVisible) { isFormVisible = true; LoadData(); } }

                                  Attached is the modified sample project. Please review it and let me know if it helps.

                                • TheGrunt 11.15.2019

                                  Hey Sasha,

                                  Big improvement but not quite where we need to be yet!
                                  Please refer to this video that I took;

                                  While the OnPaint fires repeatedly, the placement of that text jumps wildly even though there isn't any keyboard/mouse input.
                                  Please advise.

                                • Sasha (DevExpress Support) 11.18.2019

                                  Hi,

                                  You are right, the OnPaint method is called repeatedly. That's why, you need to add a flag to call the LoadData method once:

                                  [C#]
                                  bool isFormVisible; protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if(IsHandleCreated && !isFormVisible) { isFormVisible = true; LoadData(); } }

                                  I illustrated this approach in my sample. Would you please test it on your side? If it doesn't help, please modify my sample project to illustrate this issue.

                                0 Solutions

                                Creation Date Importance Sort by