JS文件内容 main.js
var xc = import('XCGUI');
var hWindow=xc.XC_LoadLayout("main.xml",0);
log("hWindow: " + hWindow);
var hButton = xc.XC_GetObjectByName("button");
xc.XEle_RegEvent(hButton, xc.XE_BNCLICK, OnBtnClick);
xc.XWnd_AdjustLayout(hWindow);
xc.XWnd_ShowWindow(hWindow,xc.SW_SHOW);
function OnBtnClick(pbHandled)
{
var rect={get:""};
xc.XEle_GetRect(hButton, rect);
alert("OnBtnClick()");
log("rect.left=" + rect.left, "rect.top="+ rect.top, "rect.right=" + rect.right, "rect.bottom=" + rect.bottom);
return 0;
}
C代码
#pragma comment(lib, "XCGUI.lib")
#include "xcgui.h"
int main(int argc, char* argv[])
{
XJS_InitJS();
XJS_RunJS("main.js");
return 0;
}
void WINAPI XExitXCGUI()
炫彩_退出 退出界面库释放资源. 不可在dllmain()中卸载, 否则会死锁
Definition: App.cpp:572
void WINAPI XRunXCGUI()
炫彩_运行 运行消息循环,当炫彩窗口数量为0时退出.
Definition: App.cpp:564
BOOL WINAPI XInitXCGUI(BOOL bD2D)
炫彩_初始化 初始化界面库.
Definition: App.cpp:557