How to add context (popup) menus to the Grid column header? [message #62929] |
Thu, 12 March 2009 14:42  |
Eclipse User |
|
|
|
Hi All,
I am using Nebula Grid, and wish to add context menu to the column
headers, such as:
Edit Column Definition
Remove Column
Insert Column Before...
Insert Column After...
I tried the Grid.setMenu(...) method. Obviously it pops up menu anywhere
in the control.
How could I add a popup menu only to the column header? Thank you so much!
Best Regards,
Frank Du
|
|
|
|
|
|
|
|
Re: How to add context (popup) menus to the Grid column header? [message #593995 is a reply to message #62929] |
Thu, 12 March 2009 16:16  |
Eclipse User |
|
|
|
I figured it out. It is resolved by MenuDetectListener.
The issue needing attention is to convert mouse click coordinate to
relative control coordinate. Then compute the rectangle of the column
headers. Then determine is the click is inside the rectangle.
Best Regards,
Frank
Frank Du wrote:
> Hi All,
> I am using Nebula Grid, and wish to add context menu to the column
> headers, such as:
> Edit Column Definition
> Remove Column
> Insert Column Before...
> Insert Column After...
> I tried the Grid.setMenu(...) method. Obviously it pops up menu anywhere
> in the control.
> How could I add a popup menu only to the column header? Thank you so much!
> Best Regards,
> Frank Du
|
|
|
Re: How to add context (popup) menus to the Grid column header? [message #594004 is a reply to message #62931] |
Thu, 12 March 2009 16:41  |
Eclipse User |
|
|
|
Hi Frank,
I was just to reply something like this. We are using MenuManager and in
the IMenuListener we are deciding which menu items we add to the menu
depdending on the current cursor location.
Tom
Frank Du schrieb:
> I figured it out. It is resolved by MenuDetectListener.
> The issue needing attention is to convert mouse click coordinate to
> relative control coordinate. Then compute the rectangle of the column
> headers. Then determine is the click is inside the rectangle.
> Best Regards,
> Frank
>
>
> Frank Du wrote:
>
>> Hi All,
>
>> I am using Nebula Grid, and wish to add context menu to the column
>> headers, such as:
>
>> Edit Column Definition
>> Remove Column
>> Insert Column Before...
>> Insert Column After...
>
>> I tried the Grid.setMenu(...) method. Obviously it pops up menu
>> anywhere in the control.
>
>> How could I add a popup menu only to the column header? Thank you so
>> much!
>
>> Best Regards,
>> Frank Du
>
>
|
|
|
Re: How to add context (popup) menus to the Grid column header? [message #594018 is a reply to message #62933] |
Fri, 13 March 2009 18:06  |
Eclipse User |
|
|
|
Hi Tom,
Thank you so much for sharing! Your method looks much more promising,
especially when we wish to display different menus on column and row
headers.
However, I have a question about determining control region. Say that we
have a Nebula Grid, with column and row headers. We set Grid's context
menu from MenuManager.
With the IMenuListener interface, how do we determine if the column or row
headers is clicked? More abstractly, how to determine which part of a
control is clicked?
Thank you so much! Have a great weekend!
Best Regards,
Frank Du
Tom Schindl wrote:
> Hi Frank,
> I was just to reply something like this. We are using MenuManager and in
> the IMenuListener we are deciding which menu items we add to the menu
> depdending on the current cursor location.
> Tom
|
|
|
Re: How to add context (popup) menus to the Grid column header? [message #594043 is a reply to message #62937] |
Sat, 14 March 2009 07:55  |
Eclipse User |
|
|
|
I'm using the cursor position - display.getCursor().getLocation().
Tom
Frank Du schrieb:
> Hi Tom,
>
> Thank you so much for sharing! Your method looks much more promising,
> especially when we wish to display different menus on column and row
> headers.
>
> However, I have a question about determining control region. Say that we
> have a Nebula Grid, with column and row headers. We set Grid's context
> menu from MenuManager.
>
> With the IMenuListener interface, how do we determine if the column or
> row headers is clicked? More abstractly, how to determine which part of
> a control is clicked?
>
> Thank you so much! Have a great weekend!
>
> Best Regards,
> Frank Du
>
>
>
> Tom Schindl wrote:
>
>> Hi Frank,
>
>> I was just to reply something like this. We are using MenuManager and in
>> the IMenuListener we are deciding which menu items we add to the menu
>> depdending on the current cursor location.
>
>> Tom
>
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03860 seconds