Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

Restore form to normal

18 REPLIES 18
SOLVED
Reply
Message 1 of 19
GeorgK
877 Views, 18 Replies

Restore form to normal

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

18 REPLIES 18
Message 2 of 19
bradeneuropeArthur
in reply to: GeorgK

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:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
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: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 !

Message 3 of 19
GeorgK
in reply to: bradeneuropeArthur

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...

Message 4 of 19
bradeneuropeArthur
in reply to: GeorgK

use form.showdialog.

form.hide

form.show

 

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
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: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 !

Message 5 of 19
GeorgK
in reply to: bradeneuropeArthur

Message 6 of 19
GeorgK
in reply to: GeorgK
Message 7 of 19
Message 8 of 19
GeorgK
in reply to: chandra.shekar.g

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.

Message 9 of 19
chandra.shekar.g
in reply to: GeorgK

@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



Message 10 of 19
GeorgK
in reply to: chandra.shekar.g

Hello @chandra.shekar.g,

 

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

 

Thank you

 

Georg

Message 11 of 19
YuhanZhang
in reply to: GeorgK

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.

Message 12 of 19
GeorgK
in reply to: YuhanZhang

Hello @YuhanZhang,

 

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

Message 13 of 19
YuhanZhang
in reply to: GeorgK

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
in reply to: YuhanZhang

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.

Message 15 of 19
YuhanZhang
in reply to: GeorgK

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.

Message 16 of 19
GeorgK
in reply to: YuhanZhang

Sorry for the confusion. The form is not modal.

Message 17 of 19
YuhanZhang
in reply to: GeorgK

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.

Message 18 of 19
GeorgK
in reply to: YuhanZhang

Hello @YuhanZhang,

 

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

 

Georg

Message 19 of 19
dudde.giridhar
in reply to: GeorgK

Hello guys,

 

This window wrapper is not working for WPF forms.

 

Can anyone suggest how to proceed further ?

 

Regards,

D.Giridhar

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report