Grid - double click on column header [message #58019] |
Mon, 18 August 2008 03:08  |
Eclipse User |
|
|
|
Hello,
In my application a double click on a grid column header should open a
dialog. If I do this
grid.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
if (e.y < grid.getHeaderHeight()) {
// open dialog
}
}
});
then the dialog gets open also when I double click the column header
divider to auto size the column, which should not happen.
My current work around was to:
1) change the grid source file to have access to hoveringOnColumnResizer
private member, so in my client code I could do
grid.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
if (e.y < grid.getHeaderHeight()
&& !grid.hoveringOnColumnResizer)
{
// open dialog
}
}
});
2) change the beginning of grid.onMouseDoubleClick(MouseEvent e) method
like this
if (hoveringOnColumnResizer)
{
int dw = columnBeingResized.getWidth(); // added
columnBeingResized.pack();
dw -= columnBeingResized.getWidth(); // added
resizingColumn = false;
handleHoverOnColumnResizer(e.x-dw, e.y); // modified
return;
}
My question: is there a simpler way to achieve this and if not could we
have it implemented in the mainstream version?
Cheers
Jacek
|
|
|
|
Re: Grid - double click on column header [message #58071 is a reply to message #58045] |
Mon, 18 August 2008 09:06  |
Eclipse User |
|
|
|
https://bugs.eclipse.org/bugs/show_bug.cgi?id=244422
Tom Schindl wrote:
> Hi,
>
> No not yet :-(. In my current fork I have also had this problem in my
> current project where I forked the grid and what I did was to adjust the
> grids mouse handlers to use the addListener()-API and customize the
> detail field of the event object (holding all the booleans used
> internally).
>
> Could you please file a bug report and we can discuss there how we can
> achieve better event support?
>
> Tom
>
> Jacek Kolodziejczyk schrieb:
>> Hello,
>>
>> In my application a double click on a grid column header should open a
>> dialog. If I do this
>>
>> grid.addMouseListener(new MouseAdapter() {
>> public void mouseDoubleClick(MouseEvent e) {
>> if (e.y < grid.getHeaderHeight()) {
>> // open dialog
>> }
>> }
>> });
>>
>> then the dialog gets open also when I double click the column header
>> divider to auto size the column, which should not happen.
>>
>> My current work around was to:
>>
>> 1) change the grid source file to have access to
>> hoveringOnColumnResizer private member, so in my client code I could do
>>
>> grid.addMouseListener(new MouseAdapter() {
>> public void mouseDoubleClick(MouseEvent e) {
>> if (e.y < grid.getHeaderHeight()
>> && !grid.hoveringOnColumnResizer)
>> {
>> // open dialog
>> }
>> }
>> });
>>
>> 2) change the beginning of grid.onMouseDoubleClick(MouseEvent e)
>> method like this
>>
>> if (hoveringOnColumnResizer)
>> {
>> int dw = columnBeingResized.getWidth(); // added
>> columnBeingResized.pack();
>> dw -= columnBeingResized.getWidth(); // added
>> resizingColumn = false;
>> handleHoverOnColumnResizer(e.x-dw, e.y); // modified
>> return;
>> }
>>
>> My question: is there a simpler way to achieve this and if not could
>> we have it implemented in the mainstream version?
>>
>> Cheers
>> Jacek
>
>
|
|
|
Re: Grid - double click on column header [message #591827 is a reply to message #58019] |
Mon, 18 August 2008 03:52  |
Eclipse User |
|
|
|
Hi,
No not yet :-(. In my current fork I have also had this problem in my
current project where I forked the grid and what I did was to adjust the
grids mouse handlers to use the addListener()-API and customize the
detail field of the event object (holding all the booleans used internally).
Could you please file a bug report and we can discuss there how we can
achieve better event support?
Tom
Jacek Kolodziejczyk schrieb:
> Hello,
>
> In my application a double click on a grid column header should open a
> dialog. If I do this
>
> grid.addMouseListener(new MouseAdapter() {
> public void mouseDoubleClick(MouseEvent e) {
> if (e.y < grid.getHeaderHeight()) {
> // open dialog
> }
> }
> });
>
> then the dialog gets open also when I double click the column header
> divider to auto size the column, which should not happen.
>
> My current work around was to:
>
> 1) change the grid source file to have access to hoveringOnColumnResizer
> private member, so in my client code I could do
>
> grid.addMouseListener(new MouseAdapter() {
> public void mouseDoubleClick(MouseEvent e) {
> if (e.y < grid.getHeaderHeight()
> && !grid.hoveringOnColumnResizer)
> {
> // open dialog
> }
> }
> });
>
> 2) change the beginning of grid.onMouseDoubleClick(MouseEvent e) method
> like this
>
> if (hoveringOnColumnResizer)
> {
> int dw = columnBeingResized.getWidth(); // added
> columnBeingResized.pack();
> dw -= columnBeingResized.getWidth(); // added
> resizingColumn = false;
> handleHoverOnColumnResizer(e.x-dw, e.y); // modified
> return;
> }
>
> My question: is there a simpler way to achieve this and if not could we
> have it implemented in the mainstream version?
>
> Cheers
> Jacek
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
|
Re: Grid - double click on column header [message #591834 is a reply to message #58045] |
Mon, 18 August 2008 09:06  |
Eclipse User |
|
|
|
https://bugs.eclipse.org/bugs/show_bug.cgi?id=244422
Tom Schindl wrote:
> Hi,
>
> No not yet :-(. In my current fork I have also had this problem in my
> current project where I forked the grid and what I did was to adjust the
> grids mouse handlers to use the addListener()-API and customize the
> detail field of the event object (holding all the booleans used
> internally).
>
> Could you please file a bug report and we can discuss there how we can
> achieve better event support?
>
> Tom
>
> Jacek Kolodziejczyk schrieb:
>> Hello,
>>
>> In my application a double click on a grid column header should open a
>> dialog. If I do this
>>
>> grid.addMouseListener(new MouseAdapter() {
>> public void mouseDoubleClick(MouseEvent e) {
>> if (e.y < grid.getHeaderHeight()) {
>> // open dialog
>> }
>> }
>> });
>>
>> then the dialog gets open also when I double click the column header
>> divider to auto size the column, which should not happen.
>>
>> My current work around was to:
>>
>> 1) change the grid source file to have access to
>> hoveringOnColumnResizer private member, so in my client code I could do
>>
>> grid.addMouseListener(new MouseAdapter() {
>> public void mouseDoubleClick(MouseEvent e) {
>> if (e.y < grid.getHeaderHeight()
>> && !grid.hoveringOnColumnResizer)
>> {
>> // open dialog
>> }
>> }
>> });
>>
>> 2) change the beginning of grid.onMouseDoubleClick(MouseEvent e)
>> method like this
>>
>> if (hoveringOnColumnResizer)
>> {
>> int dw = columnBeingResized.getWidth(); // added
>> columnBeingResized.pack();
>> dw -= columnBeingResized.getWidth(); // added
>> resizingColumn = false;
>> handleHoverOnColumnResizer(e.x-dw, e.y); // modified
>> return;
>> }
>>
>> My question: is there a simpler way to achieve this and if not could
>> we have it implemented in the mainstream version?
>>
>> Cheers
>> Jacek
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.24691 seconds