- 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:
parent
1a1c9b943a
commit
c996eca3ba
|
@ -54,10 +54,11 @@ GraphicalTerminalIO::GraphicalTerminalIO(TextSimulation* sim)
|
|||
Gtk::Box* cmdbox = manage(new HBox());
|
||||
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);
|
||||
|
||||
_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);
|
||||
|
||||
_text_input.grab_focus();
|
||||
|
@ -118,3 +119,16 @@ GraphicalTerminalIO::is_full_duplex()
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,8 @@ namespace sgpem {
|
|||
void onSend();
|
||||
|
||||
private:
|
||||
bool _on_input_commit(GdkEventKey* event);
|
||||
|
||||
TextSimulation* _sim;
|
||||
Gtk::TextView _text_output;
|
||||
mutable Gtk::Entry _text_input;
|
||||
|
|
Loading…
Reference in New Issue