Replies: 9 comments 46 replies
-
I have not heard of this tool before, I don’t see this tool in wxWidgets (C++) If you need to watch for messages and events, maybe you can use registerWatchWinMsg import traceback
from pyrx_imp import Rx, Ge, Gs, Gi, Db, Ap, Ed
#WatchWinMsg
print("command = startWatch")
print("command = endWatch")
WM_MOUSEMOVE = 512
#messageId, hwnd, lParam, wParam, pt.x, pt.y,time;
def winMessage(msg):
if msg[0] == WM_MOUSEMOVE:
print(msg[4],msg[5])
def PyRxCmd_startWatch():
try:
Ap.Application.registerWatchWinMsg(winMessage)
except Exception as err:
print(err)
def PyRxCmd_endWatch():
try:
Ap.Application.removeWatchWinMsg(winMessage)
except Exception as err:
print(err) |
Beta Was this translation helpful? Give feedback.
-
A bit off topic, but maybe it's not worth starting a new discussion. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I had issues with this, wxPython seems to have some additional wrappers, wxApp, wxPyApp Generally, this is not needed, using None for parent arguments works fine because wxTheApp is defined in C++ |
Beta Was this translation helpful? Give feedback.
-
Its weird, I would expect it to hit WxRxApp’s destructor Lines 77 to 90 in 14a8e78 |
Beta Was this translation helpful? Give feedback.
-
This line causes GstarCAD to crash on exit |
Beta Was this translation helpful? Give feedback.
-
As I mentioned here it appears to call wxApp::SetInstance and replaces my instance, when it’s garbage collected, it’s set to null, we can’t allow this, it's UB wxPyApp derives from wxApp. Unfortunately, I cannot subclass it as it’s not in in a header. Next question is, why doesn’t wx.CallAfter work with WxRxApp, I don’t see anything special in wxPyApp |
Beta Was this translation helpful? Give feedback.
-
You can also watch for events. My current goal is to have the host frame send events to |
Beta Was this translation helpful? Give feedback.
-
Added Document.getwxWindow. I could not bind events to it. |
Beta Was this translation helpful? Give feedback.
-
I played around with this. This sample is interesting because it forwards messages from PreTranslateMessage to evtLoop->PreProcessMessage(msg). I tried with AcedFilterWinMsgFn, but I could tell it bogged down performance. There’s no reason to pound on wxWidgets for messages it’s never going to handle, so I removed it. I still think the best approach for the inspector, if it needs MFC messages, is for it to use Ap.Application.registerWatchWinMsg and forward the events to the inspector. I don't know how HWNDs are mapped to wxWidget IDs though Another item that may throw things off is, I use CAcModuleResourceOverride everywhere (basically a resource switcher) side note, watchWinMsg is handy when doing stuff like trying to detect a right click, or scroll action while using AcedJig |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@CEXT-Dan
For my needs I quickly created something like this.
You open some frame, press
Ctrl+Alt+I
and an inspection frame opens. Do you think it can be done better? Maybe addPYRX_WX_DEBUG
in the configuration?The best option would be to use
wx.lib.mixins.inspection.InspectableApp
to initialize the object returned by.wxApp()
Beta Was this translation helpful? Give feedback.
All reactions