Reuse an existing ADXOlForm and ShowDialog

Add-in Express™ Support Service
That's what is more important than anything else

Reuse an existing ADXOlForm and ShowDialog
 
S?bastien Lange




Posts: 35
Joined: 2022-09-21
Hi,

I have created an ADXOlForm that manages email attachments (AttachmentsView class).
It's particularly used when creating a new email and dragging attachments to this AttachmentsView.

This form has it's own container control:
        
protected override Type GetContainerControlType()
        {
            return typeof(GreischHeaderContainerControl);
        }


In GreischHeaderContainerControl, I'm listening to double click and I execute this code to create some kind of cloned window that will stay topmost and I then can switch to a Windows Explorer and easily drag&drop files onto it:

            //Create some kind of clone
            var view = new AttachmentsView();
            view.ViewModel.Attachments = attachmentsView.ViewModel.Attachments;
            view.TopMost = true;
            view.ShowInTaskbar = true;
            view.FormBorderStyle = FormBorderStyle.FixedDialog;
            view.InspectorDragAndDrop = attachmentsView.InspectorObj as Inspector;
            //Move to top right corner of screen
            var scr = Screen.FromPoint(view.Location);
            view.Location = new Point(scr.WorkingArea.Right - view.Width, scr.WorkingArea.Top);
            view.ShowDialog();
            attachmentsView.Show();


It works fine except:
- This form has no title bar at all and so no close button, so I can only close it through the Taskbar (thanks to ShowTaskbar = true)
- Location stays at top left corner of the screen
- When I close this TopMost view, I would like to focus again on this original attachmentsView

Any idea how I could manage these issues?

Best regards,
S?bastien
Posted 13 Oct, 2022 08:00:48 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello S?bastien,

You should never create instances of an ADXOlForm: this class isn't designed for this. Use system.Windows.Forms.Form instead.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 13 Oct, 2022 09:16:38 Top