Window freez on type text into TFileEditor
paule32 opened this issue · 0 comments
paule32 commented
Hello,
I oversee something, the Code compiled fine, but on runtime, the Application can not be close (Alt+X), and the Window can not be closed. Please Help.
I have the following Code:
void TVDemo::tvEditor()
{
TMyTvEditor *editor = (TMyTvEditor *) validView(new TMyTvEditor(TRect(0, 0, 79, 23)));
if (editor != 0) {
editor->helpCtx = hcCalendar;
deskTop->insert( editor );
}
}
class TMyTvEditor : public TWindow {
public:
TMyTvEditor(const TRect& bounds):
TWindowInit(&TMyTvEditor::initFrame),
TWindow(bounds, "Mein Fenster", wnNoNumber) {
// Viewer erstellen
viewer = new TScroller(TRect(2, 2, 39, 23),
standardScrollBar(sbHorizontal),
standardScrollBar(sbVertical));
insert(viewer);
// Text-Editor erstellen
TScrollBar *hScrollBar = new TScrollBar( TRect( 2, size.y - 1, size.x - 24, size.y ) );
hScrollBar->hide();
insert(hScrollBar);
TScrollBar *vScrollBar = new TScrollBar( TRect( size.x - 23, 1, size.x - 22, size.y - 1 ) );
vScrollBar->hide();
insert(vScrollBar);
editor = new TFileEditor(TRect(1, 1, size.x - 24, size.y - 1), hScrollBar, vScrollBar, nullptr, "www.txt");
insert(editor);
options |= ofSelectable;
}
void handleEvent(TEvent &event) {
TWindow::handleEvent(event);
if (event.what == evCommand) {
switch (event.message.command) {
case cmClose:
close();
clearEvent(event);
break;
case cmButton1:
// Aktion für Schaltfläche 1
break;
case cmButton2:
// Aktion für Schaltfläche 2
break;
}
}
else {
clearEvent(event);
}
}
private:
TScroller *viewer;
TFileEditor *editor;
TButton *button1;
TButton *button2;
};