- Add yet-not-functional code for managing the "return" keypress

in the input entrybox


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@398 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-02-23 12:50:19 +00:00
parent 1a1c9b943a
commit c996eca3ba
2 changed files with 17 additions and 1 deletions

View File

@ -54,10 +54,11 @@ GraphicalTerminalIO::GraphicalTerminalIO(TextSimulation* sim)
Gtk::Box* cmdbox = manage(new HBox()); Gtk::Box* cmdbox = manage(new HBox());
mainbox->pack_end(*cmdbox, false, false); mainbox->pack_end(*cmdbox, false, false);
_text_input.signal_key_press_event().connect(sigc::mem_fun(*this, &GraphicalTerminalIO::_on_input_commit));
cmdbox->pack_start(_text_input); cmdbox->pack_start(_text_input);
_send = manage(new Button(_("Send Command"))); _send = manage(new Button(_("Send Command")));
_send->signal_clicked().connect(sigc::mem_fun(*this, &sgpem::GraphicalTerminalIO::onSend)); _send->signal_clicked().connect(sigc::mem_fun(*this, &GraphicalTerminalIO::onSend));
cmdbox->pack_start(*_send, false, true); cmdbox->pack_start(*_send, false, true);
_text_input.grab_focus(); _text_input.grab_focus();
@ -118,3 +119,16 @@ GraphicalTerminalIO::is_full_duplex()
{ {
return true; return true;
} }
bool
GraphicalTerminalIO::_on_input_commit(GdkEventKey* event)
{
// We should use Gdk::GDK_Return here, but it doesn't work for
// some reason!!
if((event->keyval & 0xFF0D) == 0xFF0D )
{
onSend();
return true;
}
return true;
}

View File

@ -58,6 +58,8 @@ namespace sgpem {
void onSend(); void onSend();
private: private:
bool _on_input_commit(GdkEventKey* event);
TextSimulation* _sim; TextSimulation* _sim;
Gtk::TextView _text_output; Gtk::TextView _text_output;
mutable Gtk::Entry _text_input; mutable Gtk::Entry _text_input;