Avalonia window (textboxes) embedded in Autodesk Inventor not accepting input #13731
-
See my post on StackOverflow: https://stackoverflow.com/questions/77543411/avalonia-window-textboxes-embedded-in-autodesk-inventor-not-accepting-input Creating an Autodesk Inventor plugin. Have a small avalonia app which I want to host in the dockable window in Inventor. Similar problem to above. There is something I'm missing about how to forward the keystrokes to the avalonia component. The key events are fired in the MainWindow code-behind, but they are not forwarded to the AvaloniaWpfHost control. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
I'm not sure why you're creating a WPF window as an intermediate if you only want Avalonia controls? Thatintermediate layer doesn't seem necessary. As far as I can tell, Inventor seems to only need a standard Win32 HWND. You can create an Avalonia Then, to handle the
|
Beta Was this translation helpful? Give feedback.
-
Hi MrJul, Thank you so much for the reply. I've just created the WPF window because I hoped it would fix the problem. I can indeed add the avalonia window to the DockableWindow by its handle. Since I'm on 11.0.x I tried the SetWindowLongPtr function. But this crashes Inventor.. I'm calling the function straight after adding the child to the dockable window. |
Beta Was this translation helpful? Give feedback.
-
It works!!!! Thanks again!! Had a feeling it would be a one-line fix..
} |
Beta Was this translation helpful? Give feedback.
I'm not sure why you're creating a WPF window as an intermediate if you only want Avalonia controls? Thatintermediate layer doesn't seem necessary. As far as I can tell, Inventor seems to only need a standard Win32 HWND.
You can create an Avalonia
Window
and get its HWND throughWindow.TryGetPlatformHandle().Handle
, that you should be able to pass directly to Inventor'sDockableWindow.AddChild()
.Then, to handle the
WM_GETDLGCODE
message, you have two choices:Win32SpecificOptions.AddWndProcHookCallback()
SetWindowLongPtr
function withGWLP_WNDPROC
to change the window procedure.