Closed incanus closed 2 years ago
Hi, thanks! I suspect you're right about the cause of the problem. I don't quite recall the history of this - other than that it is long and painful ;). I recall this module being a major pain in trying to sanitise the circular dependencies and global state that plagued the v1.2 code. However if it's not used anywhere else it looks to me like someone (i.e. me) aimed to remove the .enabled
member but didn't quite complete the task...
Given that this information is also in self.basic_events.enabled
it might still be best to replace self.basic_events.pen.enabled
with self.basic_events.pen in self.enabled
, however I need to have a closer look at what exactly is going on with .enabled
.
Fixed on develop
by commit 046696478, thanks @incanus for reporting!
Problem
Using
PEN ON
never seems to actually enable mouse event polling.Steps
Try the program below. It behaves the same whether
PEN ON
has been called or not; it never prints.Program
Notes
PC-BASIC version: 2.0.3 Operating system version: macOS 11.0.1 Beta
This appears to come down to the fact that
basicevents.py
sets up theEventHandler
superclass to have aself.enabled
flag. This isn't used by any of the subclasses (PlayHandler
,TimerHandler
,KeyHandler
, etc.). However, inimplementation.py
's pen response,pen_fn_()
, it is passed (asself.basic_events.pen.enabled
) intopen.py
'spoll()
, which always executes:If you modify
BasicEvents::command()
as follows:It works properly. However, a mod is needed to properly handle
PEN OFF
as well, again inBasicEvents::command()
:I'm happy to submit a PR if that is easier. I dug around for legacy changes to see why this might have gotten this way, but didn't find any clues so I figured I'd start a conversation first.