How to change the touch priority for UIWidget

Hi all

I am now using Cocostudio to start the development with cocos2d-x 3.0 alpha1.
I am now designing a dialog box with Modal layer concept.

The design for Modal Layer is ready as adding the code below to the layer

    auto pListen = EventListenerTouchOneByOne::create();
    pListen->setSwallowTouches(true);
    pListen->onTouchBegan = CC_CALLBACK_2(Modal::onTouchBegan, this);

    _eventDispatcher->addEventListenerWithFixedPriority(pListen, kModalLayerPriority);

which kModalLayerPriority is 128 same as the implementation before 3.0.
But now my problem is, I have to implement a dialog box above the modal layer. In previous version you can setTouchPriority for CCLayer so that it can come on top of the modal layer.
But now for example, I cannot find out how to do this in UIWidget
For example, when I work with UIButton, I can just have this code to work with the TouchListener
<pre>
pButton
>addTouchEventListener(this, toucheventselector(AlertDialog::OnButton));

Please let me know if I have missed something. Thanks

Reply to myself

Finally I found the problem is that

  1. It is not necessary to preserve the old mindset of setting a very low touch priority as modal layer
    Actually if you preserve sceneGraphPriority and swallow touches on the point that will not allow the image on the layer above to be transparent

  2. The actual problem is that previously I have implemented the dialog close mechanism as this->removeFromParent(), but now it will be crashed if I call it from the button.
    I am now seeking alternative or better sequence to close the dialog without crash. Please help if everyone know how to kill the layer itself.

Thanks

Further information. Problem solved.

My bad to learn the new idea. For the new Button touch mechanism will return several times to the buttons in different stage (START, END, MOVE). And for sure this will make this->removeFromParent not working.