AW: [Insight-users] Menu by right-mouse-click using FLTK?

Luis Ibanez luis.ibanez at kitware.com
Tue Jul 27 09:50:28 EDT 2004


Hi Zein,

Sure, simply take the orgin coordinates of your image
widget and add them to the position of the popup menu.


Regards,


   Luis


------------------
salah wrote:

> Hello Luis,
> 
> Since I plan to display different popup menus according to the positions
> of the cliched points, I decided to add a "clickSelectCallBack_right" to my viewer
> (which actually inherits GLSliceView) that reports right mouse clicks, just by
> hacking and renaming the methods from SliceView.h to my viewer and modifying my viewer's
> handle() method. I take care on popup menus in the main application that controls
> the viewer. 
> Now, everything goes well, except for the following problem: The popup menu is displayed 
> at the position relative to the absolute screen coordinates and not the viewer-widget
> coordinates. In other words, if I click within the viewer-widget at position (100, 100),
> the popup menu is displayed at position (100, 100) relative to the whole screen, i.e,
> not at the mouse positions. Is there a way to configure this effect?
> 
> Many thanks,
> 
> Zein
> 
> 
> 
> 
>>-----Ursprüngliche Nachricht-----
>>Von: Luis Ibanez [mailto:luis.ibanez at kitware.com]
>>Gesendet: Monday, July 26, 2004 4:16 PM
>>An: salah
>>Cc: ITK Users (E-Mail)
>>Betreff: Re: [Insight-users] Menu by right-mouse-click using FLTK?
>>
>>
>>
>>Hi Zein,
>>
>>Using FLTK you can display a menu with the right button
>>by managing that event on the "handle()" method.
>>
>>
>>You probably want to create a Fl_Menu_Button object
>>at that point.
>>
>>http://www.fltk.org/documentation.php/doc-1.1/Fl_Menu_Button.h
>>tml#Fl_Menu_Button
>>
>>Something like
>>
>>
>>   handle( int event )
>>   {
>>    if( event == FL_RIGHT_MOUSE )
>>       {
>>       Fl_Menu_Button * popup = new Fl_Menu_Button(0,0,400,400);
>>       popup->type(Fl_Menu_Button::POPUP3);
>>       popup->add("This|is|a popup|menu");
>>       }
>>   }
>>
>>(making popup a member variable of the
>>  viewer would be a better option...)
>>
>>
>>You will find examples of popup menus in the
>>FLTK /test directory. In particular
>>
>>    checkers.cxx
>>    menubar.cxx
>>    subwindow.cxx
>>
>>
>>Regards,
>>
>>
>>   Luis
>>
>>
>>----------------
>>salah wrote:
>>
>>
>>>Hello,
>>> 
>>>I posted this question long age and did not get an answer. 
>>
>>Please, if 
>>
>>>anybody
>>>can help of give ideas.
>>> 
>>>Thanks,
>>>Zein
>>> 
>>>
>>
>>--------------------------------------------------------------
>>-------------------- 
>>
>>>Hello All,
>>> 
>>>I am trying to implement a menu (using fltk) that appears  
>>
>>besides the 
>>
>>>mouse pointer when the right mouse
>>>buttom is pressed while the mouse pointer is inside the widget of a 
>>>GLSliceViewer.
>>> 
>>>Is there an ITK example/application that uses/implements 
>>
>>such a menu?
>>
>>> 
>>>Thanks in advanced,
>>> 
>>>Zein
>>>
>>>
>>>
>>
>>--------------------------------------------------------------
>>----------
>>
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>>
>>
> 





More information about the Insight-users mailing list