|
TalMap SDK Libary Reference |
HOWTO: Set up Events for the UI Objects of TalMapX Control. |
|
Summary
|
This document describes how to set up an Event for UI Object provided in TalMapX Control.
With this document, users can learn how to easily use the Form of the Theme Manager.
TalMapX Control provides various kinds of objects for UI(User Interface).
The Objects provided in TalMapX Control are XUIButton, XUICheckBox, XUIImage, XUIImageList, XUIImageText, XUIPanel, UIStatic, and etc.
Users can use created Event Objects. Any Event except primary Events, however, is created by user setup.
With this document, users can learn how to easily set up Events for the UI Objects.
|
|
|
Steps
|
1. Get Control Manager from TalMapX Control.
2. Get UI Manager with the Contorl Manager.
3. Make desired Objects with the UI Manager.
4. Set up desired Events using AddEventMode method of created UI Objects.
|
|
|
Example
|
|
<html>
<head>
<script language="javascript">
<!--
// Create UI
function CreateUI() {
// Step 1. Get Ctrl Manager
var ctrlman = m_Map.GetCtrlMan();
// Step 2. Get UI Manager
var uiman = ctrlman.GetUIMan();
var ctrlstate = ctrlman.GetControlState();
var dpsize = ctrlstate.GetSizeDP();
var util = m_Map.GetUtility();
var imageman = ctrlman.GetImageMan();
imageman.SetDefaultPath("http://www.talmap.co.kr/tutorial/");
// Step 3. Create UI Object
// Menu Button
var btn = uiman.CreateUI_Button(uiman);
btn.SetParent(uiman);
btn.SetUIID(10);
btn.SetCaption("Menu Button");
btn.SetBound(0, dpsize.CY - 72, 72, 72);
btn.SetImageList("image/btn_menu_72.png", 72, 72);
btn.SetAnchor(util.GetConstToValue("TMUIOBJ_ANCHOR_LEFT") | util.GetConstToValue("TMUIOBJ_ANCHOR_TOP"));
btn.SetCanFocus(1);
btn.SetCanClick(1);
btn.SetBrush(util.GetConstToValue("BS_SOLID"), util.RGBColor(255, 0, 0), 0);
btn.SetTransparent(util.GetConstToValue("TMUIOBJ_TRANSPARENT_ALL"));
btn.SetData(1);
btn.SetAlpha(70);
// Step 4. Set up necessary Events with AddEventMode
btn.AddEventMode(util.GetConstToValue("TMEVENTTYPE_MOUSEENTER") |
util.GetConstToValue("TMEVENTTYPE_MOUSELEAVE") |
util.GetConstToValue("TMEVENTTYPE_MOUSEDOWN") |
util.GetConstToValue("TMEVENTTYPE_MOUSEMOVE") |
util.GetConstToValue("TMEVENTTYPE_MOUSEUP"));
}
// Set Theme related Paths in the OnCreate Event
function MapEvent_OnCreate(Flag)
{
var ctrl = m_Map.GetCtrlMan();
var mapman = ctrl.GetMapMan();
var thememan = ctrl.GetThemeMan();
var ctrlstate = ctrl.GetControlState();
// Set Map Data Path
if (mapman.SetDefaultPath("http://localhost/MapData")) {
alert("Could not Set the Map Data Path.");
}
// Set Theme Path
thememan.SetDefaultPath("http://localhost/Theme");
if (thememan.LoadTheme("TalMap.TMT") != true) {
alert("Could not Load the Theme.");
}
ctrlstate.SetLevel(4);
ctrlstate.SetZoomScale(0.5);
}
-->
</script>
<script language="javascript" for="m_Map" event="OnCreate(Flag)">
<!--
MapEvent_OnCreate(Flag);
-->
</script>
</head>
<body>
<table>
<tr>
<td>
<OBJECT ID="m_Map" CLASSID="CLSID:DD9B48AD-EDDC-4D2C-BD68-D1FB4B382024"
codebase='http://localhost/TalMapX_Web.CAB#version=1,0,0,17' width=100% height=80%>
</OBJECT>
</td>
</tr>
</table>
</body>
</html>
|
|
|
#include "talmapxctrl1.h"
#include "CXCtrlMan.h"
#include "CXControlState.h"
#include "CXThemeMan.h"
#include "CXMapMan.h"
#include "CXAdminMan.h"
#include "CXUIMan.h"
#include "CXUtility.h"
// Create UI
void CSampleDlg::OnCreateUI()
{
// Step 1. Get Ctrl Manager
CXCtrlMan ctrlman = m_Map.GetCtrlMan();
// Step 2. Get UI Manager
CXUIMan uiman = ctrlman.GetUIMan();
CXControlState ctrlstate = ctrlman.GetControlState();
CXSize dpsize = ctrlstate.GetSizeDP();
CXUtility util = m_Map.GetUtility();
CXImageMan imageman = ctrlman.GetImageMan();
imageman.SetDefaultPath("http://www.talmap.co.kr/tutorial/");
// Step 3. Create UI Object
CXUIButton btn = uiman.CreateUI_Button(uiman);
btn.SetParent(uiman);
btn.SetCaption("Menu Button");
btn.SetBound(0, dpsize.GetCY() - 72, 72, 72);
btn.SetImageList("image/btn_menu_72.png", 72, 72);
btn.SetAnchor(util.GetConstToValue("TMUIOBJ_ANCHOR_LEFT") | util.GetConstToValue("TMUIOBJ_ANCHOR_TOP"));
btn.SetCanFocus(1);
btn.SetCanClick(1);
btn.SetBrush(util.GetConstToValue("BS_SOLID"), util.RGBColor(255, 0, 0), 0);
btn.SetTransparent(util.GetConstToValue("TMUIOBJ_TRANSPARENT_ALL"));
btn.SetAlpha(70);
// Step 4. Set up necessary Events with AddEventMode
btn.AddEventMode(util.GetConstToValue("TMEVENTTYPE_MOUSEENTER") |
util.GetConstToValue("TMEVENTTYPE_MOUSELEAVE") |
util.GetConstToValue("TMEVENTTYPE_MOUSEDOWN") |
util.GetConstToValue("TMEVENTTYPE_MOUSEMOVE") |
util.GetConstToValue("TMEVENTTYPE_MOUSEUP"));
}
|
|
|
|
See Also
|
|
Map Preview
|
|