lc-soft/LCUI


The issue has been closed
主页上的例子直接编译好多都编译不过去,老哥不改改嘛? #280
Endt4sk posted onGitHub
#include <LCUI.h>
#include <LCUI/gui/widget.h>
#include <LCUI/gui/widget/textview.h>
#include <LCUI/gui/widget/textedit.h>
#include <LCUI/gui/widget/button.h>
void OnButtonClick(LCUI_Widget self, LCUI_WidgetEvent e, void *arg)
{
wchar_t str[256] = { 0 };
LCUI_Widget text = ((LCUI_Widget*)e->data)[0];
LCUI_Widget input = ((LCUI_Widget*)e->data)[1];
TextEdit_GetTextW(input, 0, 255, str);
TextView_SetText(text, str);
}
int main(void)
{
LCUI_Widget root;
LCUI_Widget text;
LCUI_Widget button;
LCUI_Widget input;
LCUI_Widget button_data[2];
LCUI_Init();
root = LCUIWidget_GetRoot();
text = LCUIWidget_New("textview");
input = LCUIWidget_New("textedit");
button = LCUIWidget_New("button");
button_data[0] = text;
button_data[1] = input;
TextView_SetTextW(text, L"Hello, World!");
TextEdit_SetPlaceholderW(input, L"Please input...");
Button_SetTextW(button, "Change");
Widget_BindEvent(button, "click", OnButtonClick, button_data, NULL);
Widget_Append(root, text);
Widget_Append(root, input);
Widget_Append(root, button);
return LCUI_Main();
}
比如这个TextView_SetText 应该为 TextView_SetTextW
还有 Button_SetTextW(button, "Change") 应该为Button_SetTextW(button, L"Change")
新手看了例子更加一头雾水