|
|
<script language="javascript" for="m_Map" event="OnMouseUp(Flag, X, Y)">
<!--
if (Flag == 2) {
var menu = m_Map.GetApplication().GetPopupMenu();
menu.Create();
menu.AppendString(1, "ShowCenterCursor", "ShowCenterCursor", "", 1);
menu.AppendString(2, "ShowCenterLine", "ShowCenterLine", "", 2);
menu.AppendString(3, "ShowCenterRadius", "ShowCenterRadius", "", 3);
var uiman = m_Map.GetCtrlMan().GetUIMan();
var point = uiman.ClientToScreen(X, Y);
var item = menu.TrackPopupMenu(0, point.GetX(), point.GetY());
if (item) {
switch (item.GetID()) {
case 1: {
if (uiman.GetShowCenterCursor() != 0) {
uiman.SetShowCenterCursor(0);
} else {
uiman.SetShowCenterCursor(0);
}
} break;
case 2: {
if (uiman.GetShowCenterLine() != 0) {
uiman.SetShowCenterLine(0);
} else {
uiman.SetShowCenterLine(0);
}
} break;
case 3: {
if (uiman.GetShowCenterRadius() != 0) {
uiman.SetShowCenterRadius(0);
} else {
uiman.SetShowCenterRadius(0);
}
} break;
default: break;
}
}
}
-->
</script>
|
|
|
#include "talmapxctrl1.h"
#include "CXCtrlMan.h"
#include "CXUIMan.h"
#include "CXApplication.h"
#include "CXPopupMenu.h"
#include "CXPopupMenuItem.h"
BEGIN_EVENTSINK_MAP(CSampleDlg, CDialog)
ON_EVENT(CSampleDlg, IDC_TALMAPXCTRL1, 3, CSampleDlg::OnMouseUpTalmapxctrl1, VTS_I4 VTS_I4 VTS_I4)
END_EVENTSINK_MAP()
void CSampleDlg::OnMouseUpTalmapxctrl1(long Flag, long X, long Y)
{
if (Flag == 2) {
CXApplication app = m_Map.GetApplication();
CXPopupMenu menu = app.GetPopupMenu();
menu.Create();
menu.AppendString(1, _T("SetShowCenterCursor"), _T("SetShowCenterCursor"), _T(""), 1);
menu.AppendString(2, _T("SetShowCenterLine"), _T("SetShowCenterLine"), _T(""), 2);
menu.AppendString(3, _T("SetShowCenterRadius"), _T("SetShowCenterRadius"), _T(""), 3);
menu.AppendSeparator();
menu.AppendString(4, _T("ThemeForm Show"), _T("ThemeForm Show"), _T(""), 4);
CXCtrlMan ctrlman = m_Map.GetCtrlMan();
CXUIMan uiman = ctrlman.GetUIMan();
CXPoint pt = uiman.ClientToScreen(X, Y);
CXPopupMenuItem item = menu.TrackPopupMenu(0, pt.GetX(), pt.GetY());
if (item.m_lpDispatch) {
switch (item.GetID()) {
case 1:{
if (uiman.GetShowCenterCursor() != 0) {
uiman.SetShowCenterCursor(0);
} else {
uiman.SetShowCenterCursor(1);
}
} break;
case 2:{
if (uiman.GetShowCenterLine() != 0) {
uiman.SetShowCenterLine(0);
} else {
uiman.SetShowCenterLine(1);
}
} break;
case 3:{
if (uiman.GetShowCenterRadius() != 0) {
uiman.SetShowCenterRadius(0);
} else {
uiman.SetShowCenterRadius(1);
}
} break;
case 4:{
CXThemeMan thman = ctrlman.GetThemeMan();
thman.ShowForm();
} break;
default:
break;
}
}
}
}
|
|