no message

This commit is contained in:
zcy 2021-12-30 17:27:33 +08:00
parent bfb52281e8
commit 5219317a90
4 changed files with 78 additions and 10 deletions

View File

@ -137,13 +137,12 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+ std::to_wstring(gTcpServerCnt)) == mTcpServerForm.end())
{
auto form = new TcpServerFrom(this, wstring2string(info->ip), info->port, server);
form->SetChildLayoutXML(L"basic/tcp_server_form.xml");
form->SetChildLayoutXML(L"basic/tcp_form.xml");
form->SetName(key);
form->SetVisible(false);
mTcpServerForm[key] = form;
if (!mRightSide->Add(form))
printf("error 1");
}
@ -166,6 +165,7 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
mRightSide->SelectItem(p->GetName());
}
else {
wprintf(L"%s", p->GetName());
p->SetVisible(true);
mRightSide->SelectItem(p->GetName());
mRightShow = p;
@ -174,12 +174,9 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
return true;
}
);
}
if (uMsg == WM_ADD_UART_MONITOR) {
printf("add monitor");
UartInfo* p = (UartInfo*)wParam;

View File

@ -0,0 +1,34 @@
#include "tcp_server_form.h"
TcpServerFrom::TcpServerFrom(ui::Window* hwnd, string url, uint32_t port, TcpServerLibevent* p)
{
}
TcpServerLibevent* TcpServerFrom::ServerP()
{
return this->m_server;
}
void TcpServerFrom::Init()
{
ui::ChildBox::Init(); // 非常重要,没出事后childbox 后面的FindSubControl无法生效
/*
ui::Label* m_label_1 = dynamic_cast<ui::Label*>(FindSubControl(L"server_info"));
ui::RichEdit* m_rich_edit_1 = dynamic_cast<ui::RichEdit*>(FindSubControl(L"server_recv_edit"));
ui::RichEdit* m_rich_edit_2 = dynamic_cast<ui::RichEdit*>(FindSubControl(L"lua_script_edit"));
ui::RichEdit* m_rich_edit_3 = dynamic_cast<ui::RichEdit*>(FindSubControl(L"server_send_edit"));
ui::Button* m_button_1 = dynamic_cast<ui::Button*>(FindSubControl(L"btn_send_data"));
ui::CheckBox* m_check_box_2 = dynamic_cast<ui::CheckBox*>(FindSubControl(L"check_time_send"));
ui::RichEdit* m_rich_edit_4 = dynamic_cast<ui::RichEdit*>(FindSubControl(L"cycle_eidt"));
ui::CheckBox* m_check_box_3 = dynamic_cast<ui::CheckBox*>(FindSubControl(L"check_hex_send"));
ui::CheckBox* m_check_box_4 = dynamic_cast<ui::CheckBox*>(FindSubControl(L"check_hex_recv"));
ui::Button* m_button_2 = dynamic_cast<ui::Button*>(FindSubControl(L"btn_close_uart"));
ui::Label* m_label_2 = dynamic_cast<ui::Label*>(FindSubControl(L"title"));
ui::Combo* m_combo_1 = dynamic_cast<ui::Combo*>(FindSubControl(L"clients"));
ui::Button* m_button_3 = dynamic_cast<ui::Button*>(FindSubControl(L"btn_do_lua"));
*/
}

View File

@ -0,0 +1,38 @@
#pragma once
// base header
#include "base/base.h"
#include "serial_port.h"
// duilib
#include "duilib/UIlib.h"
#include "tcp_server_libevent.h"
class TcpServerFrom :
public ui::ChildBox
{
public:
TcpServerFrom(ui::Window* hwnd, string url, uint32_t port, TcpServerLibevent* p);
TcpServerLibevent* ServerP();
virtual void Init() override;
private:
TcpServerLibevent* m_server;
ui::Label* m_label_1;
ui::RichEdit* m_rich_edit_1;
ui::RichEdit* m_rich_edit_2;
ui::RichEdit* m_rich_edit_3;
ui::Button* m_button_1;
ui::CheckBox* m_check_box_1;
ui::CheckBox* m_check_box_2;
ui::RichEdit* m_rich_edit_4;
ui::CheckBox* m_check_box_3;
ui::CheckBox* m_check_box_4;
ui::Button* m_button_2;
ui::Label* m_label_2;
ui::Combo* m_combo_1;
ui::Button* m_button_3;
};

View File

@ -2,20 +2,19 @@
<ChildBox name="tcp_form" width="stretch" height="stretch">
<VBox width="stretch" height="stretch">
<Label name="uart_info_label" text="当前串口: COM" margin="0,10,0,0" height="25" />
<Label name="server_info" text="服务端ip: 端口: " margin="0,10,0,0" height="25" />
<HBox height="25" width="stretch">
<Label text="数据接收:" margin="0,10,0,0" height="25" width="stretch"/>
<Label text="lua脚本:" margin="0,10,0,0" height="25" width="stretch"/>
<Control width="stretch"/>
<Control width="stretch"/>
</HBox>
<HBox>
<RichEdit class="simple input" width="stretch" name="uart_recv_eidt" height="stretch" margin="5,5,5,5" padding="6,6,6" multiline="true" vscrollbar="true" hscrollbar="true" autovscroll="true" normaltextcolor="darkcolor" wantreturnmsg="true" rich="true" />
<RichEdit class="simple input" width="stretch" name="lua_script" height="stretch" margin="5,5,5,5" padding="6,6,6" multiline="true" vscrollbar="true" hscrollbar="true" autovscroll="true" normaltextcolor="darkcolor" wantreturnmsg="true" rich="true" />
<RichEdit class="simple input" width="stretch" name="server_recv_edit" height="stretch" margin="5,5,5,5" padding="6,6,6" multiline="true" vscrollbar="true" hscrollbar="true" autovscroll="true" normaltextcolor="darkcolor" wantreturnmsg="true" rich="true" />
<RichEdit class="simple input" width="stretch" name="lua_script_edit" height="stretch" margin="5,5,5,5" padding="6,6,6" multiline="true" vscrollbar="true" hscrollbar="true" autovscroll="true" normaltextcolor="darkcolor" wantreturnmsg="true" rich="true" />
</HBox>
<Label text="发送数据" height="25" />
<RichEdit class="simple input" width="stretch" name="uart_send_edit" height="30" margin="5,5,5,5" padding="6,6,6" />
<RichEdit class="simple input" width="stretch" name="server_send_edit" height="30" margin="5,5,5,5" padding="6,6,6" />
<HBox height="40">
<Button class="btn_global_blue_80x30" name="btn_send_data" width="100" text="发送" bkcolor="lightcolor" margin="25,3,5,3" />
<CheckBox class="checkbox_font12" name="check_new_line" text="发送新行" margin="10,12,0,0" selected="true"/>