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: 

Textbox will not accept return

17 REPLIES 17
SOLVED
Reply
Message 1 of 18
MattH_Work
766 Views, 17 Replies

Textbox will not accept return

I'm building forms that are hosted inside a dockable window. Multiline textboxes will not allow a 'return'

 

An older addin will work but for my sins I cannot find the difference in the code that turn on/off the 'return' key

 

The textboxes are set to 'multiline = true', & 'wordwrap=true' & 'acceptsreturn = true' and I have tried multiple combinations

 

Can anyone point me in the right direction


MattH
Product Design Collection 2025
Vault Pro 2025
17 REPLIES 17
Message 2 of 18

can you show a screenshot of the properties?

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 18

If multiline is set to false, the textbox height becomes fixed and therefore I can only see one line

 

Also, it still does not accept the enter key to create a new line


MattH
Product Design Collection 2025
Vault Pro 2025
Message 4 of 18

can you give the code or the properties of the textbox

 

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 18

As requested

Untitled.png


MattH
Product Design Collection 2025
Vault Pro 2025
Message 6 of 18


@bradeneuropeArthur wrote:

can you give the code or the properties of the textbox

 


Currently, there is no code relating to the textbox directly.

Once the textbox is populated, the TxtBx.text is used downstream


MattH
Product Design Collection 2025
Vault Pro 2025
Message 7 of 18

and you mean this return

bradeneuropeArthur_0-1617285578412.png

 

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 8 of 18

Exactly.

 

If I create a dummy form in a standalone exe (not Inventor dll) I can get the result I want (as shown in your screenshot)

 

If the form is part of an Inventor addin, in this case 'hosted' within a dockable form then the return key is ignored. Text can only be on one line

 

I think I read on this discussion group somewhere about others having simialr issues, but have been unable to find it

 


MattH
Product Design Collection 2025
Vault Pro 2025
Message 9 of 18

Is the form shown as modal or modeless?

frm.show

or

frm.showdialog

 

 

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 10 of 18
MattH_Work
in reply to: MattH_Work

Now its getting silly

 

Was about to take a screenshot of an addin that works (refered to in my original post) but it also now refuses to accept the enter key

NOTHING has changed in the code


MattH
Product Design Collection 2025
Vault Pro 2025
Message 11 of 18


@bradeneuropeArthur wrote:

Is the form shown as modal or modeless?

frm.show

or

frm.showdialog

 

 


Private Sub InventorAddInButtonDef_OnExecute(ByVal Context As Inventor.NameValueMap) Handles InventorAddInButtonDef.OnExecute
     If oApp.ActiveDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
          CreateDockableWindow()
     End If
End Sub

 

Private Sub CreateDockableWindow()
     Dim oUserInterfaceMgr As UserInterfaceManager
     oUserInterfaceMgr = m_inventorApplication.UserInterfaceManager
     oWindow_Dock = Nothing
Try
     oWindow_Dock = oUserInterfaceMgr.DockableWindows.Add(m_ClientId, "XXX", DockableWindow_Title)
     Catch
     oWindow_Dock = oUserInterfaceMgr.DockableWindows.Item("XXXr")
End Try
     oWindow_Dock.DisabledDockingStates = DockingStateEnum.kDockTop + DockingStateEnum.kDockBottom
     oWindow_Dock.DockingState = DockingStateEnum.kDockLeft
     oWindow_Dock.SetMinimumSize(oWindow_Dock_Height, oWindow_Dock_Width)
     oWindow_Dock.Visible = True
End Sub

 

Private Sub DocWinEvents_OnShow(DockableWindow As DockableWindow, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, ByRef HandlingCode As HandlingCodeEnum)
     If DockableWindow.Title = DockableWindow_Title Then

          Dim FormVis As String = Nothing
          FormVis = oForm_Dock.Visible.ToString
          If FormVis = False Then
               Dim oForm_Dock As New Frm_InventorAddIn
               oWindow_Dock.AddChild(oForm_Dock.Handle)
               oForm_Dock.Show()
          End If
     End If
End Sub

 

 

 

 

 

 


MattH
Product Design Collection 2025
Vault Pro 2025
Message 12 of 18
rogmitch
in reply to: MattH_Work

Does it by any chance work with SHIFT-RETURN  ?

 

Roger Mitchell

Message 13 of 18
MattH_Work
in reply to: rogmitch

Nope...


MattH
Product Design Collection 2025
Vault Pro 2025
Message 14 of 18

 FormVis = oForm_Dock.Visible.ToString
          If FormVis = False Then
               Dim oForm_Dock As New Frm_InventorAddIn
               oWindow_Dock.AddChild(oForm_Dock.Handle)
               oForm_Dock.Showdialog

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 15 of 18
nmunro
in reply to: MattH_Work

When Autodesk updated dockable windows (2018 I think) they broke keyboard handling in these forms such that some key events get handled by Inventor rather than the form or the controls within it. For a modeless form in a dockable window the ability to assign the Inventor window as the owner of the modeless form was removed. It just ignores the "Owner" argument. 

 

You can get around some of this by responding to KeyDown events in your controls/form but to completely fix it you may need to write low-level keyboard handling routines (ugh). 

        


https://c3mcad.com

Message 16 of 18
MattH_Work
in reply to: nmunro

Using the following code gives no response, zero results

 

Private Sub TxtBx_ID_Text_KeyDown(sender As Object, e As KeyEventArgs) Handles TxtBx_ID_Text.KeyDown
If e.KeyCode = Keys.Enter Then
TxtBx_ID_Text.Text &= vbCr
End If

End Sub

 

Any other key press is detected, but the enter key is completely ignored!


MattH
Product Design Collection 2025
Vault Pro 2025
Message 17 of 18

If I use .showdialog, I cannot interact with the form at all


MattH
Product Design Collection 2025
Vault Pro 2025
Message 18 of 18
MattH_Work
in reply to: nmunro

Sorted

 

Thanks

 

Private Sub TxtBx_ID_Text_KeyUp(sender As Object, e As KeyEventArgs) Handles TxtBx_ID_Text.KeyUp
If e.KeyValue = 13 Then
TxtBx_ID_Text.Text &= vbCrLf
TxtBx_ID_Text.SelectionStart = Len(TxtBx_ID_Text.Text)
TxtBx_ID_Text.ScrollToCaret()
End If
End Sub


MattH
Product Design Collection 2025
Vault Pro 2025

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

Post to forums  

Autodesk Design & Make Report