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
Solved! Go to Solution.
Solved by nmunro. Go to Solution.
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 !
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
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 !
@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
and you mean this return
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 !
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
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 !
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
@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
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 !
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).
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!
If I use .showdialog, I cannot interact with the form at all
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
Can't find what you're looking for? Ask the community or share your knowledge.