HP Forums
Custom App handling of events - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Custom App handling of events (/thread-244.html)



Custom App handling of events - jgreenb2 - 12-26-2013 04:29 PM

Tim,

Thanks for the clarification on variables, but since you're on, I thought I'd ask something else that's been confusing to me.

A built-in App like Function responds to soft-menus AND other events (key presses, mouse etc.)

If I write an App that puts up a custom menu bar I need to poll for events within a loop in order to process the soft-menus. There doesn't seem to be an API to pass events I'm not interested in to the system for processing. So if I'm handling my soft-menus, other keys (e.g. View) are basically dead.

I don't want to reproduce the functionality of every key in my App. Is there a way to handle this? Otherwise, I don't see an easy way to create useful soft-menus at the moment.


RE: Custom App handling of events - eried - 12-26-2013 06:40 PM

I think there is no multithreading or events besides the key functions for custom keys. So you need to build a simple state machine where you check the mouse (or menu?, if available) position and react to that.


RE: Custom App handling of events - jgreenb2 - 12-26-2013 08:09 PM

Eried,

I've already done that. But the problem is that there is no mechanism to respond to "system" events (i.e. ones that I am not explicitly handling).

If you look at the built-in apps they can clearly do this.


RE: Custom App handling of events - eried - 12-26-2013 08:52 PM

I understand that in this code the programming capabilities are very *sandboxed*, but can you provide an example code?


RE: Custom App handling of events - jgreenb2 - 12-27-2013 02:50 PM

Eried,

I'm sorry but I'm not ready to release code yet. I don't see how this would help anyway.


RE: Custom App handling of events - jgreenb2 - 01-02-2014 08:54 PM

Eried,

If you're interested, I did post an example in the Programs section of the forum:

http://www.hpmuseum.org/forum/thread-308.html

The app works more or less the way I want but it's fairly force-fit into the HP Prime App formalism. The notion of Symbolic/Num/Plot views isn't terrible general IMHO. I did end up writing an event loop to process key presses and mouse events. As you can see, any key events that occur while my custom menus are on screen have to be processed from within the app -- there's no way to get the system to do it currently.

-- jeff