Manoj wrote:

> Thanks for all this informtion.
> So i need to derived a class from FL_Input and handle the arrow keys there. 
> But i have no idea how to do this because there other controls like FL_Output 
> etc. You said you have done it in your own class. Please suggest how to do 
> that.

Here is the relevant part of my handle() method. My version is much 
longer, so be prepared that you may need to add more events to handle.

Albrecht



int My_Input::handle(int event) {

     int key = Fl::event_key();

     switch (event) {

     case FL_KEYDOWN:

       if ( (key==FL_Left)              // left arrow
        && (position()==0) ) {
        position(0);                    // remove mark
        return 1;
       }        

       if ( (key==FL_Right)             // right arrow
        && (position()==size()) ) {
        position(size());               // remove mark
        return 1;
       }        

       if (key==FL_Up) {                        // up arrow
        position(0);                    // move to start pos.
        return 1;
       }

       if (key==FL_Down) {              // down arrow
        position(size());               // move to end pos.
        return 1;
       }

     default:
            break;
     }
     return Fl_Input::handle(event);
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to