Languages

Menu
Sites
Language
Cannot detect touch event with holed image/panel

Hi,

I have two controls: an image panel on top (to be addcontrol first) and a table view at the bottom (to be addcontrol later). The top image panel has a hole and works like a border to reveal the tableview below. The problem is that the image panel catches all touch events, even on the holed region where I want to detect for the table view.

A possible solution is that I can split the image into 4 and add as a border but i think it is like a hack and there should be a better way, like clipping or forward events but I have not found any so far. 

Hope someone would encounter the same problem and know a better solution. Thanks.

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

4 Replies
john Smith
Hi, Better to use clip events, you can get clip events from Tizen::Animation::VisualElements class. For more information go through below link https://developer.tizen.org/help/index.jsp?topic=%2Forg.tizen.native.appprogramming%2Fhtml%2Fguide%2Fui%2Fvisualelement_clipping.htm https://developer.tizen.org/help/index.jsp?topic=%2Forg.tizen.native.appprogramming%2Fhtml%2Fguide%2Fui%2Fvisualelement.htm
le thanh dinh
Hi John, Thanks for the help. The clipping is what I thought of too. But in Tizen, there's no 'reverse' clipping like my case so that I want to clip the inside and not the outside. My (temporary) solution is to draw the top image panel instead of adding it as a control. Would be much appreciated if someone comes up with a better idea.
Dae young Ryu

The problem is only the touch detecting. Try to use SetPropagatedTouchEventListener()  API.

It's for touch event tunneling and bubbling .

Dae young Ryu

Oh... It's not a solution.

let's your image panel is pImagePanel. I found another solution.

Every control has a VisualElement , and every control use the VisualElement's ContentProvider for touch detecting.

so , if you can hook the ContentProvider of the Control's VisualEle

ment.

You can skip that your control is detected.

VisualElement provide the SetContentProvider().

class IVisualElementContentProvider
{
public:
    virtual ~IVisualElementContentProvider(void) {}

public:
    virtual bool PrepareDraw(Tizen::Ui::Animations::VisualElement& target) = 0;
    virtual void DrawContent(Tizen::Ui::Animations::VisualElement& target, Tizen::Graphics::Canvas& canvas) = 0;
    virtual HitTestResult HitTest(Tizen::Ui::Animations::VisualElement& target, const Tizen::Graphics::FloatPoint& point) = 0;
};

 

so .

1. VisualElement* pControlVE = pImagePanel()->GetVisualElement();

2. first you should get the original VisualElement's ContentProvider.

   IVisualElementContentProvider* pOrgProvider = pControlVE->GetContentProvider();

3. Set your ContentProvider.

   pControlVE->SetContentProvider(pMyContentProvider);

4. implement your ContentProvider,

   MyContentProvider::PrepareDraw(...)  {return pOrgProvider->PrepareDraw(...); }

   MyContentProvider::DrawContent(...) {pOrgProvider->DrawContent(...); }

   MyContentProvider::HitTest(...) {return HIT_TEST_NOWHERE; }  //< -- this is detecting the touch code.

 

Try do this way.