当前位置:网站首页>Screen right-click menu in souI

Screen right-click menu in souI

2022-04-23 18:52:00 Brick Porter

at present SOUI Only the text control has a right-click menu . But generally speaking, it may not be necessary to display . Even if you want to display it, you may need to beautify it and so on . Here's how to deal with it .

First step : Add the right-click event of all controls to the event processing .

EVENT_MAP_BEGIN()
        ...
		EVENT_HANDLER(EVT_CTXMENU, OnCtxMenu)
EVENT_MAP_END()

The second step : Handling events , take bCancel Set to TRUE. You can cancel the right-click menu . Of course, it can also be ID Or name to partially disable or enable .

void OnCtxMenu(EventArgs* pEvt)
{
	EventCtxMenu* pRelEvt = sobj_cast<EventCtxMenu>(pEvt);
	if (pRelEvt)
	{
		pRelEvt->bCancel = TRUE;
	}
}

Of course, it can also be replaced with its own menu . Like beautification .

版权声明
本文为[Brick Porter]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210603257351.html