[Insight-users] Another FltkImageViewer Keyboard Qustion

Stephen R. Aylward aylward@unc.edu
Tue, 28 Jan 2003 13:16:17 -0500


Hi,

I think that is a really good question for the FLTK mail list.  Sorry - 
it is beyond my fltk knowledge.

Sounds like it would be a nice addition to the system if you can make it 
work!

Thanks,
Stephen

Feng Ma wrote:
> Hi,
> 
>  I have another quesiton about FltkImageViewer keyboard. I have trouble 
> with KEYUP event. In SliceView.h, we don't really use the KEYUP event. I 
> tried to modify the viewer to allow faster scrolling while pressing the 
> ">" or "<" key. That is, when ">" or "<" is pressed for sometime, the 
> image will scroll every 3 or 5 slices, rather than 1 slice. When the key 
> is released, the moving pace will restore to 1.
> 
>  So I need to capture the KEYUP event. What I found was: whenever there 
> is an update() called, the KEYUP event is issued. So, I kept receiving 
> KEYUP event. That is not what I want.
> 
>  The code segment I changed in SliceView.h is:
> 
>  In SliceView::handle() method:
> 
>  Add two variables:
>  int fastMove = 0; //flag if moving faster than 1
>  const int fastMoveVal = 3; //pace of fast moving
> 
>  ....
> 
>      case FL_KEYUP:
>        fprintf(stderr, "***KEY UP***\n");
>        fastMove = 0;
>        return 0;
> 
>        break;
> 
>    case FL_KEYBOARD:
>    case FL_SHORTCUT:
>      key = Fl::event_text()[0];
>      switch(key)
> 
>      ....
>        case '>':
>        case '.':
>            fprintf(stderr, "fastMove = %d\n", fastMove);
>            if( fastMove < fastMoveVal){
>                fastMove ++;
> 
>      if((int)cWinCenter[cWinOrder[2]]+1>(int)cDimSize[cWinOrder[2]]-1)
>                    return 1;
>                sliceNum(cWinCenter[cWinOrder[2]]+1);
>            }
>            else{
>                
> if((int)cWinCenter[cWinOrder[2]]+fastMoveVal>(int)cDimSize[cWinOrder[2]]-1)
>                    return 1;
>                sliceNum(cWinCenter[cWinOrder[2]]+fastMoveVal);
>            }
> 
>          this->update();
>          return 1;
>          break;
> 
>  Thanks.
> 
> -Feng
> 
> 
> _________________________________________________________________
> The new MSN 8: advanced junk mail protection and 2 months FREE*  
> http://join.msn.com/?page=features/junkmail
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users


-- 
===============================================
Dr. Stephen R. Aylward
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://caddlab.rad.unc.edu
aylward@unc.edu
(919) 966-9695