Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » How to add context (popup) menus to the Grid column header?
How to add context (popup) menus to the Grid column header? [message #62929] Thu, 12 March 2009 18:42 Go to next message
Frank Du is currently offline Frank Du
Messages: 91
Registered: July 2009
Member
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 #62931 is a reply to message #62929] Thu, 12 March 2009 20:16 Go to previous messageGo to next message
Frank Du is currently offline Frank Du
Messages: 91
Registered: July 2009
Member
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 #62933 is a reply to message #62931] Thu, 12 March 2009 20:41 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5342
Registered: July 2009
Senior Member
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 #62937 is a reply to message #62933] Fri, 13 March 2009 22:06 Go to previous messageGo to next message
Frank Du is currently offline Frank Du
Messages: 91
Registered: July 2009
Member
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 #62943 is a reply to message #62937] Sat, 14 March 2009 11:55 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5342
Registered: July 2009
Senior Member
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
>
>
>
>
Re: How to add context (popup) menus to the Grid column header? [message #62996 is a reply to message #62943] Tue, 14 April 2009 14:56 Go to previous message
Frank Du is currently offline Frank Du
Messages: 91
Registered: July 2009
Member
Woo hoo! I got it! Thanks so much!

Frank

Tom Schindl wrote:

> I'm using the cursor position - display.getCursor().getLocation().

> Tom
Re: How to add context (popup) menus to the Grid column header? [message #593995 is a reply to message #62929] Thu, 12 March 2009 20:16 Go to previous message
Frank Du is currently offline Frank Du
Messages: 91
Registered: July 2009
Member
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 20:41 Go to previous message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5342
Registered: July 2009
Senior Member
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 22:06 Go to previous message
Frank Du is currently offline Frank Du
Messages: 91
Registered: July 2009
Member
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 11:55 Go to previous message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5342
Registered: July 2009
Senior Member
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
>
>
>
>
Re: How to add context (popup) menus to the Grid column header? [message #594345 is a reply to message #62943] Tue, 14 April 2009 14:56 Go to previous message
Frank Du is currently offline Frank Du
Messages: 91
Registered: July 2009
Member
Woo hoo! I got it! Thanks so much!

Frank

Tom Schindl wrote:

> I'm using the cursor position - display.getCursor().getLocation().

> Tom
Previous Topic:org.eclipse.swt.nebula.snippets - Gantchart Examples in incorrect package
Next Topic:CDateTime: Changing Icons
Goto Forum:
  


Current Time: Tue Sep 30 11:53:36 GMT 2014

Powered by FUDForum. Page generated in 0.03780 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software