From 99dd9c112c9f150a5bceeb12acd14def226bca37 Mon Sep 17 00:00:00 2001 From: mrbesen Date: Thu, 23 Nov 2023 22:22:45 +0100 Subject: [PATCH] text entry --- inc/tgtui.h | 1 + src/tgtui.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/inc/tgtui.h b/inc/tgtui.h index 8762d17..7c62ada 100644 --- a/inc/tgtui.h +++ b/inc/tgtui.h @@ -39,6 +39,7 @@ private: CDKSCROLL* chatsScroll = nullptr; CDKSCROLL* chatScroll = nullptr; + CDKENTRY* textEntry = nullptr; bool shouldRun = false; std::thread tuiThread; diff --git a/src/tgtui.cpp b/src/tgtui.cpp index 2ea8281..7e92f00 100644 --- a/src/tgtui.cpp +++ b/src/tgtui.cpp @@ -125,9 +125,10 @@ void TgTUI::threadLoop() { }); chatsScroll = newCDKScroll(cdkScr, LEFT, TOP, RIGHT, 0, 40, "Chats:", chatsItemList.data(), chatsItemList.size(), FALSE, A_REVERSE, TRUE, FALSE); - chatScroll = newCDKScroll(cdkScr, 41, TOP, RIGHT, 0, -41, "Chat:", nullptr, 0, FALSE, A_REVERSE, TRUE, FALSE); clearVec(chatsItemList); } + chatScroll = newCDKScroll(cdkScr, 42, TOP, RIGHT, -4, -42, "Chat:", nullptr, 0, FALSE, A_REVERSE, TRUE, FALSE); + textEntry = newCDKEntry(cdkScr, 42, BOTTOM, "Text:", "", 0, ' ', EDisplayType::vCHAR, -42, 1, 2048, TRUE, FALSE); while(shouldRun) { activateCDKScroll(chatsScroll, nullptr); @@ -143,12 +144,17 @@ void TgTUI::threadLoop() { activateCDKScroll(chatScroll, nullptr); + if(chatScroll->exitType == vNORMAL) { + activateCDKEntry(textEntry, nullptr); + } + tgclient.closeChat(chat.chatId); } } destroyCDKScroll(chatsScroll); destroyCDKScroll(chatScroll); + destroyCDKEntry(textEntry); chats.clear();