Skip to main content

Touch Support

Touch eventsinput handling is done by deriving from TouchableBehavior. Behaviors which are derived from genericCgiStudioControl::TouchableBehavior eventsget registered to the TouchSession and arewill equallyreceive easyInput toEvents implement.
Foras anClick, examplePressed ofetc use have a look atthrough the ToggleButtonWidgetOnEvent function.

and

For it'sexample:

base

Derive from TouchableBehavior:

class CgiEventWidget.ControlStateBehavior : public TouchableBehavior

Override OnEvent function:

    Set EventMask. The EventMask determines which event types will be sent.
            const UInt cTbTouchEventExit = CgiEventWidget::TouchEventExit;
            const UInt cTbTouchEventUp = CgiEventWidget::TouchEventUp;
            const UInt cTbTouchEventDown = CgiEventWidget::TouchEventDown;
    
    
            Base::SetEventMask(cTbTouchEventExit | cTbTouchEventUp | cTbTouchEventDown);
    

    Override listener function.
            protected:
    
      virtual void OnTouchEvent(TouchEventOnEvent(const touchEvent,FeatStd::Event& event, Candera::EventDispatchResult& dispatchResult) override;
    
    


    One such behavior is the "Handle Control State" behavior. In SceneComposer, just add a "Handle Control State" to a node and it will be able to receive touch events. Pair it with a condition behavior such as "Check Click" or "Check Hover", and you will be able to detect touch events and can be used to react on the user's input.

    For more information, please check Candera::NodeTouch Input Handling.*

    node,

    To const CgiApplication::MouseEvent& event);

    Defineimplement your actionsown insidecustom thegesture/touch listenerhandler, functionplease OnTouchEvent.check
    out switch(touchEvent)Gesture {Detector case TouchEventDown:
                    m_focus = true;
                    SetOn(!IsOn());
                    break;
                case TouchEventUp:
                    if (m_focus) {
                        SendUiEvent(TouchEventClick, 0);
                    }
                    break;
                case TouchEventExit:
                    m_focus = false;
                    m_down = !m_down;
                    SwitchTexture();
                    break;
                default:
                    break;
            }
    

    page.