Restore form to normal

Restore form to normal

GeorgK
Advisor Advisor
1,242 Views
18 Replies
Message 1 of 19

Restore form to normal

GeorgK
Advisor
Advisor

Hello together,

 

I have a form which I open with an add-in. When the user trys to open the form again and the form is open and minimized the form should came back to it's original size and normal.

 

Public Function FormIsLoaded(ByVal sName As String) As Boolean
Dim bResult As Boolean = False

            ' alle geöffneten Forms durchlauden
            For Each oForm As Form In System.Windows.Forms.Application.OpenForms
                If oForm.Name.ToLower = sName.ToLower Then
                    bResult = True : Exit For
                End If
            Next

            Return (bResult)
        End Function
Private Sub oButtonDefinition287_Vault_OnExecute(Context As NameValueMap) Handles oButtonDefinition287_Vault.OnExecute Dim MyLocalForm As New Form_Vault If Not FormIsLoaded("Form_Vault") Then MyLocalForm.Show(New WindowWrapper(m_inventorApplication.MainFrameHWND)) 'Das Form wird an das Fenster von Inventor gebunden Else ShowWindow(MyLocalForm.WindowState, SHOW_WINDOW.SW_NORMAL) End If End Sub

How could I do this?

 

Thanks

Georg

0 Likes
Accepted solutions (2)
1,243 Views
18 Replies
Replies (18)
Message 2 of 19

bradeneuropeArthur
Mentor
Mentor

could you please explain this a little more?

seems that you are not using Form.showdialog or Form.show, but I am not sure of it.

 

Regards

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 19

GeorgK
Advisor
Advisor

With:

 

MyLocalForm.Show(New WindowWrapper(m_inventorApplication.MainFrameHWND)) 

I bind the form on Inventor.  But how could I bring it to the top?

 

There is a good explanation:

https://forums.autodesk.com/t5/inventor-customization/converting-autocad-bas-to-inventor/td-p/761770

 

http://adndevblog.typepad.com/manufacturing/2016/06/access-a-specific-inventorapplication-object.htm...

0 Likes
Message 4 of 19

bradeneuropeArthur
Mentor
Mentor

use form.showdialog.

form.hide

form.show

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 19

GeorgK
Advisor
Advisor
0 Likes
Message 7 of 19

chandra.shekar.g
Autodesk Support
Autodesk Support
0 Likes
Message 8 of 19

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g, @bradeneuropeArthur,

 

sorry but I could not bring the form up, when the user has minimized the Inventor application child form. The parent form is maximized.

0 Likes
Message 9 of 19

chandra.shekar.g
Autodesk Support
Autodesk Support

@GeorgK,

 

Can you please provide sample source code and reproducible steps to investigate? Video record is better to visualise scenario.

 

Please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 10 of 19

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

there is a sample code. Not a good one but it shows the problem.

 

Thank you

 

Georg

0 Likes
Message 11 of 19

YuhanZhang
Autodesk
Autodesk

If I understand correct, you can do it like below to bring the form back to top of Inventor UI when it is minimized:

 

1. In Windows task bar click the Inventor button to show the preview button.

2. Click the form preview button to bring it back to top of Inventor.

FormClick.png

 

 

But a suggestion is, in your sample project you use Form.ShowDialog which creates a modal dialog in Inventor, usually we don't need the Maximize/Minimize buttons for the dialog, so if no special reason you can just hide them, i.e. set the MaximizeBox and MinimizeBox to False in the Properties panel. And also I recommend to set the ShowInTaskbar to False if you hide the maximize and minimize buttons:

 

FormProperties.png



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 12 of 19

GeorgK
Advisor
Advisor

Hello @YuhanZhang,

 

the problem is to bring the form back by programming not by a click from the user.

0 Likes
Message 13 of 19

YuhanZhang
Autodesk
Autodesk

Then can you tell me do you want a modal dialog or modaless dialog? And why you allow users to minimize the dialog? I want to understand what is your requirement for the dialog behavior.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 14 of 19

GeorgK
Advisor
Advisor
MyLocalForm.ShowDialog(New WindowWrapper(m_inventorApplication.MainFrameHWND))

The user should do some work when the form is minimized. But the form should come up, when the user clicks the function again.  Sometimes the user didn't see the form when it's minimized.

0 Likes
Message 15 of 19

YuhanZhang
Autodesk
Autodesk

If you use the ShowDialog, the form is modal then you can't interact with Inventor no matter the form is minimized or not, so I just want to know what workflow you design it that your customers need to minimize the form? And with a modal dialog showed you can't click the button again unless you dispose the modal form. So in this case the users manually minimize the form and then they need to manually restore it from the task bar. This is why I suggest to just hide the Minimize&Maxmize buttons on the form, and this is also the case for most of Inventor built-in dialogs(modal & modaless dialogs). Hope this explains.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 16 of 19

GeorgK
Advisor
Advisor

Sorry for the confusion. The form is not modal.

0 Likes
Message 17 of 19

YuhanZhang
Autodesk
Autodesk
Accepted solution

I updated your project and attached, you can try if it is what you want.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 18 of 19

GeorgK
Advisor
Advisor

Hello @YuhanZhang,

 

thank you very much. That's exactly what I am looking for.

 

Georg

0 Likes
Message 19 of 19

dudde.giridhar
Enthusiast
Enthusiast
Accepted solution

Hello guys,

 

This window wrapper is not working for WPF forms.

 

Can anyone suggest how to proceed further ?

 

Regards,

D.Giridhar