Home » U++ Library support » TabCtrl » TabCtrl related question
TabCtrl related question [message #55110] |
Sun, 11 October 2020 18:04  |
sinpeople
Messages: 29 Registered: October 2020 Location: Singapore
|
Promising Member |

|
|
Hi folks,
I have developed a dialog-based application which works ok.
Now I want to extend the program into multiple instances under a TabCtrl. Basically, I need to downgrade the <TopWindow> main window to some low level one, such that it can be added to a TabCtrl.
How I can do that? I searched "TabCtrl" in the code coming from the installation package. The 2x examples are both having different layout for the tabbed window. My case is much simpler. I want to chain multiple instance of a window layout to TabCtrl. But I don't know what I should do to achieve this.
The code of my current dialog program is the following:
class MainWindow : public WithMainWindowLayout<TopWindow>, public CallbackQueue, public Reader::Notify, public Writer::Notify, public RpcCmder::Notify
{
public: //thread GUI
MainWindow(int nPort);
public: //thread Worker
virtual void OnReplyRead(int nData, int x2, String s) {Request(&MainWindow::SaveReadResult,nData,x2,s);}
virtual void OnReplyWrite(int nData, int x2, String s) {Request(&MainWindow::SaveWriteResult,nData,x2,s);}
virtual void OnReplyRpcCmd(int nData, int x2, String s) {Request(&MainWindow::SaveRpcCmdResult,nData,x2,s);}
private:
void ReadSensors() {reader.Request(&Reader::ReadSensors);}
void WriteCtrl(int nData) {writer.Request(&Writer::WriteCtrl, nData);}
void RpcCmd(UrrRequest r) {rpcCmder.Request(&RpcCmder::RpcCmd, r);}
void SaveReadResult(int nData, int x2, String s);
void SaveWriteResult(int nData, int x2, String s);
void SaveRpcCmdResult(int nData, int x2, String s);
void SpawnTasks();
void AddDataToAlgoQueue(String strTimeStamp, int nData);
void AddDataToLoggerQueue(String strTimeStamp, int nData);
void DoTasksAndStatistics();
}
Thank you very much!
Best Regards
David
|
|
|
Re: TabCtrl related question [message #55124 is a reply to message #55110] |
Mon, 12 October 2020 23:21   |
omari
Messages: 276 Registered: March 2010
|
Experienced Member |
|
|
you can replace TopWindow with ParentCtrl,
class MainWindow : public WithMainWindowLayout<ParentCtrl>, public CallbackQueue, public Reader::Notify, public Writer::Notify, public RpcCmder::Notify
then
TabDlg dlg;
MainWindow tab[5];
for(int i = 0; i < 5; i++)
dlg(tab[i], String("Tab")<<i);
dlg .OKCancel()
.Title("Tab dialog");
dlg.Run();
regards
omari.
|
|
|
|
Re: TabCtrl related question [message #55137 is a reply to message #55110] |
Tue, 13 October 2020 14:27  |
 |
mirek
Messages: 14257 Registered: November 2005
|
Ultimate Member |
|
|
sinpeople wrote on Sun, 11 October 2020 18:04Hi folks,
I have developed a dialog-based application which works ok.
Now I want to extend the program into multiple instances under a TabCtrl. Basically, I need to downgrade the <TopWindow> main window to some low level one, such that it can be added to a TabCtrl.
How I can do that? I searched "TabCtrl" in the code coming from the installation package. The 2x examples are both having different layout for the tabbed window. My case is much simpler. I want to chain multiple instance of a window layout to TabCtrl. But I don't know what I should do to achieve this.
The code of my current dialog program is the following:
class MainWindow : public WithMainWindowLayout<TopWindow>, public CallbackQueue, public Reader::Notify, public Writer::Notify, public RpcCmder::Notify
{
public: //thread GUI
MainWindow(int nPort);
public: //thread Worker
virtual void OnReplyRead(int nData, int x2, String s) {Request(&MainWindow::SaveReadResult,nData,x2,s);}
virtual void OnReplyWrite(int nData, int x2, String s) {Request(&MainWindow::SaveWriteResult,nData,x2,s);}
virtual void OnReplyRpcCmd(int nData, int x2, String s) {Request(&MainWindow::SaveRpcCmdResult,nData,x2,s);}
private:
void ReadSensors() {reader.Request(&Reader::ReadSensors);}
void WriteCtrl(int nData) {writer.Request(&Writer::WriteCtrl, nData);}
void RpcCmd(UrrRequest r) {rpcCmder.Request(&RpcCmder::RpcCmd, r);}
void SaveReadResult(int nData, int x2, String s);
void SaveWriteResult(int nData, int x2, String s);
void SaveRpcCmdResult(int nData, int x2, String s);
void SpawnTasks();
void AddDataToAlgoQueue(String strTimeStamp, int nData);
void AddDataToLoggerQueue(String strTimeStamp, int nData);
void DoTasksAndStatistics();
}
Thank you very much!
Best Regards
David
I might be wrong in understanding the issue, but maybe you should have
Array<MainWindow> tab;
somewhere. Then use tab.Add() to create the widgets that you put into TabCtrl.
Mirek
|
|
|
Goto Forum:
Current Time: Sun May 11 14:46:29 CEST 2025
Total time taken to generate the page: 0.07144 seconds
|