dcstoyanov:
I've checked the event
ON_EVENT(ON_CLICK,m_button_close,OnClickButtonClose)
defined in Include\Controls\Dialog.mqh but it seems to work correctly: it closes the Dialog when the bitmap "close" receives a click.
I think it should be:
ON_NAMED_EVENT(ON_CLICK,m_button_close,OnClickButtonClose)
Then the code example must be correct as follows:
void CGui::OnClickButton1() { if (!dialog.IsVisible()) { dialog.Visible(true); } else { CreateDialog(); CreateButton2(); } }
Can someone confirm (that is a bug in the Library)?
dcstoyanov:
Unfortunately, creating the Dialog "on request" produces an invalid ID (lparam = -1) and so, all events that rely on lparam are not associated with the Dialog and its objects.
This issue is very similar to this one https://www.mql5.com/en/forum/376645, except that there the Dialog(s) are created at the beginning and immediately set to Hide(), while I would like to create the Dialog only on request.
Is that the only approach or am I missing something in my code?
Apparently, the only correct way is to create the Dialog and all its objects and then control their visibility.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
the minimal example shown here is an AppDialog with a Button which should create a separate Dialog with a second Button.
The problem is that clicking on any area of the Dialog (except the caption) set the Dialog to be Visible(false).
I've checked the event
ON_EVENT(ON_CLICK,m_button_close,OnClickButtonClose)
defined in Include\Controls\Dialog.mqh but it seems to work correctly: it closes the Dialog when the bitmap "close" receives a click.
This issue is very similar to this one https://www.mql5.com/en/forum/376645, except that there the Dialog(s) are created at the beginning and immediately set to Hide(), while I would like to create the Dialog only on request.
Is that the only approach or am I missing something in my code?