I decided to add some functionality to the program so that it
        will actually run unix + dos shell commands in the 'terminal'.

        See:
        http://seriss.com/people/erco/fltk/#SimpleTerminal

        So you can run commands like ls/dir/ps and see predictable results
        just like a normal terminal.

        The widget of course does NOT handle programs like vi or emacs;
        that would involve full on terminal emulation, which is beyond
        the scope of this example.

        But for simple application command prompts, this should give people
        a very good starting point, if not a complete example.

        Adding the shell command execution was just a few lines of popen()
        code, which went a long way towards making this example very realistic.
        Tested on linux and windows.

Greg Ercolano wrote:
>       Keyboard Events
> 
>       FL_KEYDOWN, FL_KEYUP
>       A key was pressed or released. The key can be found in 
> *Fl::event_key()*.
>       The text that the key should insert can be found with *Fl::event_text()*
>       and its length is in *Fl::event_length()*. [..]
> 
> So based on that, I'd say change these two lines:
> 
>                     cmd[i+0] = (char)key;
>                     cmd[i+1] = 0;
> 
> ..to instead read:
> 
>                     strncat(cmd, Fl::event_text(), sizeof(cmd)-1);
> 
> ..and that /should/ handle translating non-ascii codes correctly.

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to