.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modeless problem

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
609 Views, 8 Replies

Modeless problem

Hi all!

I have a little problem : when I minimize the autoCAD window, I still see my modeless dialogs in the desktop. ;(

Please is there a way to minimize them with their parent window(AutoCAD), or just close them. Something like events perhaps?

Sorry for my English and thanks in advance for anyone who can help.

Aymen,
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

use ShowModelessDialog of the Application object.

wrote in message news:5328784@discussion.autodesk.com...
Hi all!

I have a little problem : when I minimize the autoCAD window, I still see my
modeless dialogs in the desktop. ;(

Please is there a way to minimize them with their parent window(AutoCAD), or
just close them. Something like events perhaps?

Sorry for my English and thanks in advance for anyone who can help.

Aymen,
Message 3 of 9
Anonymous
in reply to: Anonymous

Hi Paul!

The problem is that I'm using ShowModelessDialog...

Aymen,
Message 4 of 9
Anonymous
in reply to: Anonymous

I don't know what's up. It works for me. Post the code you're using.

Also, do search for "ShowModelessDialog" Tony posted a nice example
which implements a singleton method.

wrote in message news:5328833@discussion.autodesk.com...
Hi Paul!

The problem is that I'm using ShowModelessDialog...

Aymen,
Message 5 of 9
Anonymous
in reply to: Anonymous

We're not fortune tellers with crystal balls, so
we don't know what your code is doing without
seeing a reproducible case.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5328833@discussion.autodesk.com...
Hi Paul!

The problem is that I'm using ShowModelessDialog...

Aymen,
Message 6 of 9
Anonymous
in reply to: Anonymous

And I thought you could do all. I need to
go rethink the universe. 🙂
"Tony Tanzillo" wrote in message
news:5330428@discussion.autodesk.com...
We're not fortune tellers with crystal balls, so
we don't know what your code is doing without
seeing a reproducible case.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5328833@discussion.autodesk.com...
Hi Paul!

The problem is that I'm using ShowModelessDialog...

Aymen,
Message 7 of 9
Anonymous
in reply to: Anonymous

Try using second ShowModelessDialog constructor, passing ACAD window handle
as it's second parameter.

Regards,
Maksim Sestic

wrote in message news:5328784@discussion.autodesk.com...
Hi all!

I have a little problem : when I minimize the autoCAD window, I still see my
modeless dialogs in the desktop. ;(

Please is there a way to minimize them with their parent window(AutoCAD), or
just close them. Something like events perhaps?

Sorry for my English and thanks in advance for anyone who can help.

Aymen,
Message 8 of 9
Anonymous
in reply to: Anonymous

Hi all,

Sorry, I had some personal problems...(Now, it's Ok!)

This is the code, it is supposed to work like the acet-ui-status (a lisp command displaying a modeless dialog with custom text).

First file :
///----------------------------------------------------------------------

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

using Autodesk.AutoCAD.Runtime;


namespace TestNamespace
{
public class TestUiStatusClass
{
//Importing necessary DLLS

[DllImport("USER32.DLL")]
public static extern IntPtr SetFocus(System.IntPtr hwnd);


UiStatusForm TestForm = new UiStatusForm();

//Command Calls

[CommandMethod("UiStatus")]
public void showErr()
{
if (TestForm.Visible)
{ TestForm.Hide(); }
else
{
IWin32Window owner = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Window;
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(owner, TestForm);

TestForm.Location = new System.Drawing.Point(200, 200);

Label label1 = new System.Windows.Forms.Label();
Label label2 = new System.Windows.Forms.Label();
////
//// label1
////
label1.AutoSize = true;
label1.BackColor = System.Drawing.Color.Transparent;
label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
label1.Location = new System.Drawing.Point(70, 9);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(116, 24);
label1.TabIndex = 0;
label1.Text = "MessageTitle : ";
TestForm.Controls.Add(label1);
////
//// label2
////
label2.AutoSize = true;
label2.BackColor = System.Drawing.Color.Transparent;
label2.ForeColor = System.Drawing.Color.White;
label2.Location = new System.Drawing.Point(80, 24);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(273, 13);
label2.TabIndex = 1;
label2.Tag = "";
label2.Text = "\nTest text";
TestForm.Controls.Add(label2);

IntPtr hwnd = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Window.Handle;
SetFocus(hwnd);
}
}
}
}

///----------------------------------------------------------------------
Second file:
///----------------------------------------------------------------------
using System.Windows.Forms;

namespace TestNamespace
{
///
/// Summary description for ModalForm.
///

public class UiStatusForm : System.Windows.Forms.Form
{

//private IContainer components;

public UiStatusForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}
private System.ComponentModel.Container components = null;
///
/// Clean up any resources being used.
///

protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UiStatusForm));
this.SuspendLayout();
//
// UiStatusForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.AutoSize = true;
this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange;
this.BackColor = System.Drawing.Color.Red;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));/// place any Background Image you want
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(270, 70);
this.ForeColor = System.Drawing.Color.White;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximumSize = new System.Drawing.Size(320, 640);
this.MinimumSize = new System.Drawing.Size(270, 70);
this.Name = "UiStatusForm";
this.Opacity = 0.9;
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.ResumeLayout(false);

}

#endregion

}
}

///----------------------------------------------------------------------


Thanks in advance and sorry again.

Aymen,
Message 9 of 9
Anonymous
in reply to: Anonymous


Did you try with:

 


size=2>Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(Application.MainWindow,
TestForm);

Regards,

Maksim Sestic

 

 

Hi all,

Sorry, I had
some personal problems...(Now, it's Ok!)

This is the code, it is supposed
to work like the acet-ui-status (a lisp command displaying a modeless dialog
with custom text).

First file
:
///----------------------------------------------------------------------

using
System;
using System.Windows.Forms;
using
System.Runtime.InteropServices;

using
Autodesk.AutoCAD.Runtime;


namespace
TestNamespace
{
   public class
TestUiStatusClass
{
    //Importing necessary
DLLS

    [DllImport("USER32.DLL")]
   
public static extern IntPtr SetFocus(System.IntPtr hwnd);



    UiStatusForm TestForm = new
UiStatusForm();
    
    //Command
Calls

      
[CommandMethod("UiStatus")]
       public void
showErr()
      
{
           if
(TestForm.Visible)
          
{ TestForm.Hide();
}
          
else
          
{
              
IWin32Window owner =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Window;
              
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(owner,
TestForm);

              
TestForm.Location = new System.Drawing.Point(200,
200);

              
Label label1 = new
System.Windows.Forms.Label();
              
Label label2 = new
System.Windows.Forms.Label();
              
////

              
////
label1
              
////

              
label1.AutoSize =
true;
              
label1.BackColor =
System.Drawing.Color.Transparent;
              
label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((byte)(0)));
              
label1.Location = new System.Drawing.Point(70,
9);
              
label1.Name =
"label1";
              
label1.Size = new System.Drawing.Size(116,
24);
              
label1.TabIndex =
0;
              
label1.Text = "MessageTitle :
";
              
TestForm.Controls.Add(label1);
              
////

              
////
label2
              
////

              
label2.AutoSize =
true;
              
label2.BackColor =
System.Drawing.Color.Transparent;
              
label2.ForeColor =
System.Drawing.Color.White;
              
label2.Location = new System.Drawing.Point(80,
24);
              
label2.Name =
"label2";
              
label2.Size = new System.Drawing.Size(273,
13);
              
label2.TabIndex =
1;
              
label2.Tag =
"";
              
label2.Text = "\nTest
text";
              
TestForm.Controls.Add(label2);

              
IntPtr hwnd =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Window.Handle;
              
SetFocus(hwnd);
          
}
       }
}
}


///----------------------------------------------------------------------
Second
file:
///----------------------------------------------------------------------
using
System.Windows.Forms;

namespace TestNamespace
{
///
<summary>
/// Summary description for ModalForm.
///
</summary>
    public class UiStatusForm :
System.Windows.Forms.Form
   
{

        //private IContainer
components;

        public
UiStatusForm()
{
//
// Required for Windows Form Designer
support
//
InitializeComponent();

//
// TODO: Add any
constructor code after InitializeComponent
call
//
       
}
        private
System.ComponentModel.Container components = null;
/// <summary>
///
Clean up any resources being used.
///
</summary>
        protected
override void Dispose(bool
disposing)
       
{
            if
(disposing)
           
{
               
if (components !=
null)
               
{
                   
components.Dispose();
               
}
           
}
           
base.Dispose(disposing);
       
}

#region Windows Form Designer generated code
///
<summary>
/// Required method for Designer support - do not
modify
/// the contents of this method with the code editor.
///
</summary>
private void
InitializeComponent()
{
           
System.ComponentModel.ComponentResourceManager resources = new
System.ComponentModel.ComponentResourceManager(typeof(UiStatusForm));
           
this.SuspendLayout();
           
//
            //
UiStatusForm
           
//
           
this.AutoScaleBaseSize = new System.Drawing.Size(5,
13);
           
this.AutoSize =
true;
           
this.AutoValidate =
System.Windows.Forms.AutoValidate.EnablePreventFocusChange;
           
this.BackColor =
System.Drawing.Color.Red;
           
this.BackgroundImage =
((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));/// place
any Background Image you
want
           
this.BackgroundImageLayout =
System.Windows.Forms.ImageLayout.None;
           
this.ClientSize = new System.Drawing.Size(270,
70);
           
this.ForeColor =
System.Drawing.Color.White;
           
this.FormBorderStyle =
System.Windows.Forms.FormBorderStyle.None;
           
this.MaximumSize = new System.Drawing.Size(320,
640);
           
this.MinimumSize = new System.Drawing.Size(270,
70);
           
this.Name =
"UiStatusForm";
           
this.Opacity =
0.9;
           
this.ShowIcon =
false;
           
this.ShowInTaskbar =
false;
           
this.StartPosition =
System.Windows.Forms.FormStartPosition.Manual;
           
this.ResumeLayout(false);

}

#endregion      


}
}

///----------------------------------------------------------------------


Thanks
in advance and sorry again.

Aymen,

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost