PC机完整良好的ITESoCSDK环境;基于之前建立的Hello_ITE工程;不涉及硬件,不需要;
UI调用代码,代码控制UI。
在layer_hello.c下编辑功能函数;
//SDKprojectHello_ITElayer_hello.c
#券商券商量化交易接口平台,量化交易接口平台,include <assert.h>
#券商券商量化交易接口平台,量化交易接口平台,include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "scene.h"
bool HelloFunction(ITUWidget* widget, char* param)
{
printf("Hello ITE.
");//用printf输出log信息
return true;
}
双击SDKuildwin32Hello_ITcmd构建win32仿真环境;双击SDKuildwin32Hello_ITEHello_ITsln打开工程,并仿真如下;为了方便代码管理,对应的helloLayer我们新建一个layer_hello.c;将新建的layer_hello.c放到SDKprojectHello_ITE下;修改makefile增加文件;
add_executable(${CMAKE_PROJECT_NAME}
layer_logo.c
layer_air_conditioner.c
layer_hello.c
)
编辑功能代码,实现代码控制UI
通过VS2013构建环境
本实验目的:
设计一个UI界面
双击SDKuildwin32Hello_ITcmd重新构建win32下工程;win32仿真下能看到新建的layer_hello.c文件。
常见问题处理
注册函数到全局表内;
//SDKprojectHello_ITEfunction_table.c
#include "ite/itu.h"
extern bool HelloFunction(ITUWidget* widget, char* param);
ITUActionFunction actionFunctions[] =
{
"HelloFunction", HelloFunction,
NULL, NULL
};
UI配置界面设置调用函数条件;主动类的控件都有很多Action,代表控件触发的动作,顺序执行。在Action01配置Action为function表示利用程序中的函数来决定执行这件事,Event配置为Press表示按下立即触发事件,Parameter为函数传参,Target为注册函数名,必须对应代码中函数。保存UI文件并Export到对应的ITU路径;双击SDKuildwin32Hello_ITcmd重新构建win32下工程,然后仿真工程;发现连续点击Button按钮,log会同步输出预设字符:HelloIT
编辑功能函数;
//SDKprojectHello_ITElayer_hello.c
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "scene.h"
static ITUText *helloText;
bool HelloFunction(ITUWidget* widget, char* param)
{
printf("Hello ITE.
");//用printf输出log信息
helloText = ituSceneFindWidget(&theScene, "helloText");
assert(helloText);
ituTextSetString(helloText, "Hello ITE."); //设置helloText控件显示字符串Hello ITE.
return true;
}
通过DrawrockerGUIDesigner.exe设计一个UI界面;UI界面上一个Button按钮,一个text文本控件;点击button按钮,调用函数ButtonFunction;ButtonFunction函数输出一个log信息;ButtonFunction函数设置Text控件显示“HelloITE”;
编辑功能代码,实现UI调用代码
文章为作者独立观点,不代表股票交易接口观点