These are chat archives for highfidelity/hifi

Jul 2017
Sachin Mahapure
Jul 26 2017 07:11
Jul 26 2017 16:55
anyone familiar with how the menu tablet is defined in code?
I assume it's scripted because I can find it links to some TabletScriptingInterface code, but not so much where the buttons and menus are defined and how they link to their functions
(interface's menu.cpp defines the toolbar's menu, but I'm looking for the tablet one)
Melissa Brown
Jul 26 2017 18:51
Let me see if the instructions for creating a tablet app will behelpful
hmm. . .looks like it's all scripting
Jeff Moyes
Jul 26 2017 20:02

Anyone know how to do the following for a Tablet app?

I have my file createWidget.js that runs in the context of HighFidelity/scriptengine js space (I'll refer to this as the tablet)
I have my file widget.js that runs inside the tablet as a webapp/QTWebEngine context (I'll refer to this as the app)

I know I can communicate between the two by having a webevent emitter -- EventBridge.emitWebEvent(JSON.stringify( <MY_EVENT_OBJECT> )); -- in the app/widget.js and a webevent receiver -- tablet.webEventReceived.connect( <HANDLER_FUNCTION> ); in the tablet/createWidget.js

But what if I want to communicate the other way around? I tried putting an emitter in the tablet -- tablet.emitWebEvent(JSON.stringify( <MY_EVENT_OBJECT> )); -- and a receiver -- EventBridge.webEventReceived.connect( <HANDLER_FUNCTION> ); -- in the app, but it never saw anything.

(Interestingly enough, the app receiver did see the events sent from the apps' own emitter, and the tablet's receiver saw the events sent from the tablet's own emitter)


App Emitter -> Tablet Receiver (Works)
App Emitter -> App Receiver (Works)
Tablet Emitter -> Tablet Receiver (Works)
Tablet Emitter -> App Receiver (DOESN'T seem to Work)

Does anybody have any ideas?

It should be EventBridge.emitWebEvent(msg); On the app js side. and var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); tablet.webEventReceived.connect(onWebEventReceived);on the tablet side. To use your naming convention
Oh sorry, I seem to have reversed the naming conventions.
Anthony Thibault
Jul 26 2017 22:00
for "Tablet Emitter -> App Receiver (DOESN'T seem to Work)" The Tablet side:
    var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
the app side:
    // hook up a handler for events that come from hifi.
    EventBridge.scriptEventReceived.connect(function (msg) {
        if (msg === "button-2-done") {
            console.log("got here!");