-
Hello,
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi Jens! To use the built-in window counters, you just have to initialize the tvision/source/tvision/tframe.cpp Lines 69 to 79 in 0917f04 However, as you can see, it only displays window numbers smaller than 10. To calculate the window number, I guess the idiomatic way would be to define a custom broadcast event (e.g. void TMyApp::createNewWindow() {
int maxWindowNum = (int)(size_t) message(this, evBroadcast, cmGetMaxWindowNum, 0);
int newWindowNum = maxWindowNum + 1;
auto *myWindow = new TMyWindow(TRect(/* ... */), "Title", newWindowNum);
insert(myWindow);
}
void TMyWindow::handleEvent(TEvent &ev) {
TWindow::handleEvent(ev); // Or whichever other class you are inheriting from.
if (ev.what == evBroadcast && ev.message.command == cmGetMaxWindowNum) {
if (number > ev.message.infoInt) // 'number' field is inherited from TWindow.
ev.message.infoInt = number;
// Do not clearEvent(), since this is a broadcast event which other windows should also handle.
}
} |
Beta Was this translation helpful? Give feedback.
Hi Jens!
To use the built-in window counters, you just have to initialize the
number
field in your dialog (inherited fromTWindow
). The code for drawing the window counter is inTFrame
:tvision/source/tvision/tframe.cpp
Lines 69 to 79 in 0917f04
However, as you can see, it only displays window numbers smaller than 10.
To calculate the window number, I guess the idiomatic way would be to define a custom broa…