Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Table rightclick menu
Table rightclick menu [message #445742] Wed, 10 November 2004 13:04 Go to next message
Henrik Skovgaard is currently offline Henrik SkovgaardFriend
Messages: 84
Registered: July 2009
Member
Hi group

I have a table in which I have a POPUP menu shown when the user rightclicks
in it.
I want different behaviour of this menu regarding which row or MenuItem
being clicked. However, when a user fx clicks row 10, then the behaviour for
this row is first activated after the second click on that row. It is for
example the setEnabled(false) that does not work as expected in this
example.

Here's a snippit of my code:

private void drawResultTable() {
resultTable = new Table(composite1, SWT.FULL_SELECTION |
SWT.V_SCROLL);
//resultTable.setLayoutData(new GridData(GridData.FILL_BOTH));


resultTable.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent evt) {
final int index = resultTable.getSelectionIndex();
if (index == -1) return;
final IssueTableLine item = (IssueTableLine) resultTable.getItem
(index);

Menu menu = new Menu (getShell(), SWT.POP_UP);

MenuItem openItem = new MenuItem(menu, SWT.PUSH);
openItem.setText("Open Issue");
openItem.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event event) {
final int index = resultTable.getSelectionIndex();
if (index == -1) return;
final IssueTableLine item = (IssueTableLine)
resultTable.getItem (index);

openIssueTab(item);
}
});

MenuItem statusMenuItem = new MenuItem(menu, SWT.CASCADE);
statusMenuItem.setText("Status");
Menu statusMenu = new Menu(statusMenuItem);
statusMenuItem.setMenu(statusMenu);
if(resultTable.getItem(index).getText(6).equals("Closed")) {
statusMenuItem.setEnabled(false);
}

MenuItem menuitem = new MenuItem (statusMenu, SWT.PUSH);
menuitem.setText ("Closed");
resultTable.setMenu (menu);

menuitem.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event event) {
final int index = resultTable.getSelectionIndex();
if (index == -1) return;
final IssueTableLine item = (IssueTableLine)
resultTable.getItem (index);

setIssueStatus(item, "Closed");
}
});
}
});

resultTable.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent evt) {
final int index = resultTable.getSelectionIndex();
if (index == -1) return;
final IssueTableLine item = (IssueTableLine) resultTable.getItem
(index);
openIssueTab(item);
}
});

resultTable.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
if (evt.character != SWT.CR)
return;

final int index = resultTable.getSelectionIndex();
if (index == -1) return;
final IssueTableLine item = (IssueTableLine) resultTable.getItem
(index);
openIssueTab(item);
}
});

resultTable.setLinesVisible(true);
createResultTableColumns(resultTable);
}
Re: Table rightclick menu [message #445751 is a reply to message #445742] Wed, 10 November 2004 14:57 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Sorry, I'm not quite sure what you are asking. Please construct a small
stand alone example that shows the problem out of your code below so I can
run it. Thanks.

"Henrik Skovgaard" <hsk@reklamedata.dk.no.spam> wrote in message
news:cmt3j1$460$1@eclipse.org...
> Hi group
>
> I have a table in which I have a POPUP menu shown when the user
rightclicks
> in it.
> I want different behaviour of this menu regarding which row or MenuItem
> being clicked. However, when a user fx clicks row 10, then the behaviour
for
> this row is first activated after the second click on that row. It is for
> example the setEnabled(false) that does not work as expected in this
> example.
>
> Here's a snippit of my code:
>
> private void drawResultTable() {
> resultTable = new Table(composite1, SWT.FULL_SELECTION |
> SWT.V_SCROLL);
> //resultTable.setLayoutData(new GridData(GridData.FILL_BOTH));
>
>
> resultTable.addMouseListener(new MouseAdapter() {
> public void mouseDown(MouseEvent evt) {
> final int index = resultTable.getSelectionIndex();
> if (index == -1) return;
> final IssueTableLine item = (IssueTableLine) resultTable.getItem
> (index);
>
> Menu menu = new Menu (getShell(), SWT.POP_UP);
>
> MenuItem openItem = new MenuItem(menu, SWT.PUSH);
> openItem.setText("Open Issue");
> openItem.addListener (SWT.Selection, new Listener () {
> public void handleEvent (Event event) {
> final int index = resultTable.getSelectionIndex();
> if (index == -1) return;
> final IssueTableLine item = (IssueTableLine)
> resultTable.getItem (index);
>
> openIssueTab(item);
> }
> });
>
> MenuItem statusMenuItem = new MenuItem(menu, SWT.CASCADE);
> statusMenuItem.setText("Status");
> Menu statusMenu = new Menu(statusMenuItem);
> statusMenuItem.setMenu(statusMenu);
> if(resultTable.getItem(index).getText(6).equals("Closed")) {
> statusMenuItem.setEnabled(false);
> }
>
> MenuItem menuitem = new MenuItem (statusMenu, SWT.PUSH);
> menuitem.setText ("Closed");
> resultTable.setMenu (menu);
>
> menuitem.addListener (SWT.Selection, new Listener () {
> public void handleEvent (Event event) {
> final int index = resultTable.getSelectionIndex();
> if (index == -1) return;
> final IssueTableLine item = (IssueTableLine)
> resultTable.getItem (index);
>
> setIssueStatus(item, "Closed");
> }
> });
> }
> });
>
> resultTable.addMouseListener(new MouseAdapter() {
> public void mouseDoubleClick(MouseEvent evt) {
> final int index = resultTable.getSelectionIndex();
> if (index == -1) return;
> final IssueTableLine item = (IssueTableLine) resultTable.getItem
> (index);
> openIssueTab(item);
> }
> });
>
> resultTable.addKeyListener(new KeyAdapter() {
> public void keyPressed(KeyEvent evt) {
> if (evt.character != SWT.CR)
> return;
>
> final int index = resultTable.getSelectionIndex();
> if (index == -1) return;
> final IssueTableLine item = (IssueTableLine) resultTable.getItem
> (index);
> openIssueTab(item);
> }
> });
>
> resultTable.setLinesVisible(true);
> createResultTableColumns(resultTable);
> }
>
>
Re: Table rightclick menu [message #445755 is a reply to message #445751] Wed, 10 November 2004 15:29 Go to previous messageGo to next message
Henrik Skovgaard is currently offline Henrik SkovgaardFriend
Messages: 84
Registered: July 2009
Member
"Steve Northover" <steve_northover@ca.ibm.com> wrote in message
news:cmta8h$l8l$1@eclipse.org...
> Sorry, I'm not quite sure what you are asking. Please construct a small
> stand alone example that shows the problem out of your code below so I can
> run it. Thanks.

It is when I right click in the table. That event is being caught by the
"mouseDown(MouseEvent evt)" listener. Inside that scope, I create the popup
menu that has to be displayed. In some cases I want the "Status" menuitem to
be grayed out (done by setEnabled(false); ).

Thing is, that right after starting the application and I rightclick on a
table row, the popup menu is not displayed. Second time I rightclick, it is
being displayed - but the content of the menu displayed is now "one click"
old. See what I mean now?

Thanks,
Henrik


>
> "Henrik Skovgaard" <hsk@reklamedata.dk.no.spam> wrote in message
> news:cmt3j1$460$1@eclipse.org...
>> Hi group
>>
>> I have a table in which I have a POPUP menu shown when the user
> rightclicks
>> in it.
>> I want different behaviour of this menu regarding which row or MenuItem
>> being clicked. However, when a user fx clicks row 10, then the behaviour
> for
>> this row is first activated after the second click on that row. It is for
>> example the setEnabled(false) that does not work as expected in this
>> example.
>>
>> Here's a snippit of my code:
>>
>> private void drawResultTable() {
>> resultTable = new Table(composite1, SWT.FULL_SELECTION |
>> SWT.V_SCROLL);
>> //resultTable.setLayoutData(new GridData(GridData.FILL_BOTH));
>>
>>
>> resultTable.addMouseListener(new MouseAdapter() {
>> public void mouseDown(MouseEvent evt) {
>> final int index = resultTable.getSelectionIndex();
>> if (index == -1) return;
>> final IssueTableLine item = (IssueTableLine)
>> resultTable.getItem
>> (index);
>>
>> Menu menu = new Menu (getShell(), SWT.POP_UP);
>>
>> MenuItem openItem = new MenuItem(menu, SWT.PUSH);
>> openItem.setText("Open Issue");
>> openItem.addListener (SWT.Selection, new Listener () {
>> public void handleEvent (Event event) {
>> final int index = resultTable.getSelectionIndex();
>> if (index == -1) return;
>> final IssueTableLine item = (IssueTableLine)
>> resultTable.getItem (index);
>>
>> openIssueTab(item);
>> }
>> });
>>
>> MenuItem statusMenuItem = new MenuItem(menu, SWT.CASCADE);
>> statusMenuItem.setText("Status");
>> Menu statusMenu = new Menu(statusMenuItem);
>> statusMenuItem.setMenu(statusMenu);
>> if(resultTable.getItem(index).getText(6).equals("Closed")) {
>> statusMenuItem.setEnabled(false);
>> }
>>
>> MenuItem menuitem = new MenuItem (statusMenu, SWT.PUSH);
>> menuitem.setText ("Closed");
>> resultTable.setMenu (menu);
>>
>> menuitem.addListener (SWT.Selection, new Listener () {
>> public void handleEvent (Event event) {
>> final int index = resultTable.getSelectionIndex();
>> if (index == -1) return;
>> final IssueTableLine item = (IssueTableLine)
>> resultTable.getItem (index);
>>
>> setIssueStatus(item, "Closed");
>> }
>> });
>> }
>> });
>>
>> resultTable.addMouseListener(new MouseAdapter() {
>> public void mouseDoubleClick(MouseEvent evt) {
>> final int index = resultTable.getSelectionIndex();
>> if (index == -1) return;
>> final IssueTableLine item = (IssueTableLine)
>> resultTable.getItem
>> (index);
>> openIssueTab(item);
>> }
>> });
>>
>> resultTable.addKeyListener(new KeyAdapter() {
>> public void keyPressed(KeyEvent evt) {
>> if (evt.character != SWT.CR)
>> return;
>>
>> final int index = resultTable.getSelectionIndex();
>> if (index == -1) return;
>> final IssueTableLine item = (IssueTableLine)
>> resultTable.getItem
>> (index);
>> openIssueTab(item);
>> }
>> });
>>
>> resultTable.setLinesVisible(true);
>> createResultTableColumns(resultTable);
>> }
>>
>>
>
>
Re: Table rightclick menu [message #445905 is a reply to message #445755] Thu, 11 November 2004 18:23 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Rather than using a mouse down listener, I think you should use the show and
hide listeners of the Menu. If the menu has no items then it will not be
shown. Also, if you want the menu to appear when the user right mouse clicks
on the table, you should create the menu on the table. See the modified
code below:

public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
final Table resultTable = new Table(shell, SWT.FULL_SELECTION);
resultTable.setLinesVisible(true);
for (int i = 0; i < 10; i++) {
TableItem item = new TableItem(resultTable, SWT.NONE);
item.setText("item "+i);
}
TableItem item = new TableItem(resultTable, SWT.NONE);
item.setText("Closed");

final Menu menu = new Menu(resultTable);
resultTable.setMenu(menu);
menu.addMenuListener(new MenuAdapter() {
public void menuShown(MenuEvent e) {
final int index = resultTable.getSelectionIndex();
if (index == -1) return;
MenuItem openItem = new MenuItem(menu, SWT.PUSH);
openItem.setText("Open Issue");
openItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
// do work
}
});

MenuItem statusMenuItem = new MenuItem(menu,
SWT.CASCADE);
statusMenuItem.setText("Status");
Menu statusMenu = new Menu(statusMenuItem);
statusMenuItem.setMenu(statusMenu);
if
(resultTable.getItem(index).getText().equals("Closed")) {
statusMenuItem.setEnabled(false);
}

MenuItem menuitem = new MenuItem(statusMenu,
SWT.PUSH);
menuitem.setText("Closed");

menuitem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
// do work
}
});
}
public void menuHidden(MenuEvent e) {
MenuItem[] items = menu.getItems();
for (int i = 0; i < items.length; i++) {
items[i].dispose();
}
}
});

shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

"Henrik Skovgaard" <hsk@reklamedata.dk.no.spam> wrote in message
news:cmtc3c$png$1@eclipse.org...
>
> "Steve Northover" <steve_northover@ca.ibm.com> wrote in message
> news:cmta8h$l8l$1@eclipse.org...
>> Sorry, I'm not quite sure what you are asking. Please construct a small
>> stand alone example that shows the problem out of your code below so I
>> can
>> run it. Thanks.
>
> It is when I right click in the table. That event is being caught by the
> "mouseDown(MouseEvent evt)" listener. Inside that scope, I create the
> popup menu that has to be displayed. In some cases I want the "Status"
> menuitem to be grayed out (done by setEnabled(false); ).
>
> Thing is, that right after starting the application and I rightclick on a
> table row, the popup menu is not displayed. Second time I rightclick, it
> is being displayed - but the content of the menu displayed is now "one
> click" old. See what I mean now?
>
> Thanks,
> Henrik
>
>
>>
>> "Henrik Skovgaard" <hsk@reklamedata.dk.no.spam> wrote in message
>> news:cmt3j1$460$1@eclipse.org...
>>> Hi group
>>>
>>> I have a table in which I have a POPUP menu shown when the user
>> rightclicks
>>> in it.
>>> I want different behaviour of this menu regarding which row or MenuItem
>>> being clicked. However, when a user fx clicks row 10, then the behaviour
>> for
>>> this row is first activated after the second click on that row. It is
>>> for
>>> example the setEnabled(false) that does not work as expected in this
>>> example.
>>>
>>> Here's a snippit of my code:
>>>
>>> private void drawResultTable() {
>>> resultTable = new Table(composite1, SWT.FULL_SELECTION |
>>> SWT.V_SCROLL);
>>> //resultTable.setLayoutData(new GridData(GridData.FILL_BOTH));
>>>
>>>
>>> resultTable.addMouseListener(new MouseAdapter() {
>>> public void mouseDown(MouseEvent evt) {
>>> final int index = resultTable.getSelectionIndex();
>>> if (index == -1) return;
>>> final IssueTableLine item = (IssueTableLine)
>>> resultTable.getItem
>>> (index);
>>>
>>> Menu menu = new Menu (getShell(), SWT.POP_UP);
>>>
>>> MenuItem openItem = new MenuItem(menu, SWT.PUSH);
>>> openItem.setText("Open Issue");
>>> openItem.addListener (SWT.Selection, new Listener () {
>>> public void handleEvent (Event event) {
>>> final int index = resultTable.getSelectionIndex();
>>> if (index == -1) return;
>>> final IssueTableLine item = (IssueTableLine)
>>> resultTable.getItem (index);
>>>
>>> openIssueTab(item);
>>> }
>>> });
>>>
>>> MenuItem statusMenuItem = new MenuItem(menu, SWT.CASCADE);
>>> statusMenuItem.setText("Status");
>>> Menu statusMenu = new Menu(statusMenuItem);
>>> statusMenuItem.setMenu(statusMenu);
>>> if(resultTable.getItem(index).getText(6).equals("Closed"))
>>> {
>>> statusMenuItem.setEnabled(false);
>>> }
>>>
>>> MenuItem menuitem = new MenuItem (statusMenu, SWT.PUSH);
>>> menuitem.setText ("Closed");
>>> resultTable.setMenu (menu);
>>>
>>> menuitem.addListener (SWT.Selection, new Listener () {
>>> public void handleEvent (Event event) {
>>> final int index = resultTable.getSelectionIndex();
>>> if (index == -1) return;
>>> final IssueTableLine item = (IssueTableLine)
>>> resultTable.getItem (index);
>>>
>>> setIssueStatus(item, "Closed");
>>> }
>>> });
>>> }
>>> });
>>>
>>> resultTable.addMouseListener(new MouseAdapter() {
>>> public void mouseDoubleClick(MouseEvent evt) {
>>> final int index = resultTable.getSelectionIndex();
>>> if (index == -1) return;
>>> final IssueTableLine item = (IssueTableLine)
>>> resultTable.getItem
>>> (index);
>>> openIssueTab(item);
>>> }
>>> });
>>>
>>> resultTable.addKeyListener(new KeyAdapter() {
>>> public void keyPressed(KeyEvent evt) {
>>> if (evt.character != SWT.CR)
>>> return;
>>>
>>> final int index = resultTable.getSelectionIndex();
>>> if (index == -1) return;
>>> final IssueTableLine item = (IssueTableLine)
>>> resultTable.getItem
>>> (index);
>>> openIssueTab(item);
>>> }
>>> });
>>>
>>> resultTable.setLinesVisible(true);
>>> createResultTableColumns(resultTable);
>>> }
>>>
>>>
>>
>>
>
>
Re: Table rightclick menu [message #445939 is a reply to message #445905] Mon, 15 November 2004 15:06 Go to previous messageGo to next message
Henrik Skovgaard is currently offline Henrik SkovgaardFriend
Messages: 84
Registered: July 2009
Member
Thanks. I tried your suggestion, but it does not seem that the listeners on
the menuitems are working correctly. I'm posting the code again here with
your modifications. I would have expected that the System.out.println()
would produce some text in the console when I select the 'Open' menuitem.

(don't mind the 'bad' naming of the objects, I'm just trying to get it to
work first)

/Henrik


private void drawResultTable() {
resultTable = new Table(composite1, SWT.FULL_SELECTION |
SWT.V_SCROLL);
resultTable.setLinesVisible(true);
createResultTableColumns(resultTable);

final Menu menu = new Menu (resultTable);
resultTable.setMenu(menu);

menu.addMenuListener(new MenuAdapter() {
public void menuShown(MenuEvent e) {
final int index = resultTable.getSelectionIndex();
if (index == -1) return;
final IssueTableLine item = (IssueTableLine) resultTable.getItem
(index);

MenuItem openItem = new MenuItem(menu, SWT.PUSH);
openItem.setText("Open Issue");
openItem.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event event) {
System.out.println("HEY");
openIssueTab(item);
}
});

MenuItem statusMenuItem = new MenuItem(menu, SWT.CASCADE);
statusMenuItem.setText("Status");
Menu statusMenu = new Menu(statusMenuItem);
statusMenuItem.setMenu(statusMenu);
if(resultTable.getItem(index).getText(6).equals("Closed")) {
statusMenuItem.setEnabled(false);
}

MenuItem menuitem = new MenuItem (statusMenu, SWT.PUSH);
menuitem.setText ("Closed");

menuitem.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event event) {
setIssueStatus(item, "Closed");
}
});
}

public void menuHidden(MenuEvent e) {
MenuItem[] items = menu.getItems();
for (int i = 0; i < items.length; i++) {
items[i].dispose();
}
}
});

}



"Veronika Irvine" <veronika_irvine@oti.com> wrote in message
news:cn0an4$5ml$1@eclipse.org...
> Rather than using a mouse down listener, I think you should use the show
> and hide listeners of the Menu. If the menu has no items then it will not
> be shown. Also, if you want the menu to appear when the user right mouse
> clicks on the table, you should create the menu on the table. See the
> modified code below:
>
Re: Table rightclick menu [message #445992 is a reply to message #445939] Mon, 15 November 2004 18:38 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Sorry my fault, the selection event comes after the menu hidden event so the
menu items where disposed too early. Here is an improved version:

public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
final Table resultTable = new Table(shell, SWT.FULL_SELECTION |
SWT.V_SCROLL);
resultTable.setLinesVisible(true);
// createResultTableColumns(resultTable);
for (int i = 0; i < 10; i++) {
TableItem item = new TableItem(resultTable, SWT.NONE);
item.setText("item "+i);
}

final Menu menu = new Menu (resultTable);
resultTable.setMenu(menu);

menu.addMenuListener(new MenuAdapter() {
public void menuShown(MenuEvent e) {

MenuItem[] items = menu.getItems();
for (int i = 0; i < items.length; i++) {
items[i].dispose();
}

final int index = resultTable.getSelectionIndex();
if (index == -1) return;
//final IssueTableLine item = (IssueTableLine)
resultTable.getItem(index);
TableItem item = (TableItem)
resultTable.getItem(index);

MenuItem openItem = new MenuItem(menu, SWT.PUSH);
openItem.setText("Open Issue");
openItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("Open Issue");
//openIssueTab(item);
}
});

MenuItem statusMenuItem = new MenuItem(menu,
SWT.CASCADE);
statusMenuItem.setText("Status");
Menu statusMenu = new Menu(statusMenuItem);
statusMenuItem.setMenu(statusMenu);
if
(resultTable.getItem(index).getText(6).equals("Closed")) {
statusMenuItem.setEnabled(false);
}

MenuItem menuitem = new MenuItem(statusMenu,
SWT.PUSH);
menuitem.setText("Closed");
menuitem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("Closed");
//setIssueStatus(item, "Closed");
}
});
}
});
shell.pack();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}

"Henrik Skovgaard" <hsk@reklamedata.dk.no.spam> wrote in message
news:cnagmh$8gt$1@eclipse.org...
> Thanks. I tried your suggestion, but it does not seem that the listeners
> on the menuitems are working correctly. I'm posting the code again here
> with your modifications. I would have expected that the
> System.out.println() would produce some text in the console when I select
> the 'Open' menuitem.
>
> (don't mind the 'bad' naming of the objects, I'm just trying to get it to
> work first)
>
> /Henrik
>
>
> private void drawResultTable() {
> resultTable = new Table(composite1, SWT.FULL_SELECTION |
> SWT.V_SCROLL);
> resultTable.setLinesVisible(true);
> createResultTableColumns(resultTable);
>
> final Menu menu = new Menu (resultTable);
> resultTable.setMenu(menu);
>
> menu.addMenuListener(new MenuAdapter() {
> public void menuShown(MenuEvent e) {
> final int index = resultTable.getSelectionIndex();
> if (index == -1) return;
> final IssueTableLine item = (IssueTableLine) resultTable.getItem
> (index);
>
> MenuItem openItem = new MenuItem(menu, SWT.PUSH);
> openItem.setText("Open Issue");
> openItem.addListener (SWT.Selection, new Listener () {
> public void handleEvent (Event event) {
> System.out.println("HEY");
> openIssueTab(item);
> }
> });
>
> MenuItem statusMenuItem = new MenuItem(menu, SWT.CASCADE);
> statusMenuItem.setText("Status");
> Menu statusMenu = new Menu(statusMenuItem);
> statusMenuItem.setMenu(statusMenu);
> if(resultTable.getItem(index).getText(6).equals("Closed")) {
> statusMenuItem.setEnabled(false);
> }
>
> MenuItem menuitem = new MenuItem (statusMenu, SWT.PUSH);
> menuitem.setText ("Closed");
>
> menuitem.addListener (SWT.Selection, new Listener () {
> public void handleEvent (Event event) {
> setIssueStatus(item, "Closed");
> }
> });
> }
>
> public void menuHidden(MenuEvent e) {
> MenuItem[] items = menu.getItems();
> for (int i = 0; i < items.length; i++) {
> items[i].dispose();
> }
> }
> });
>
> }
>
>
>
> "Veronika Irvine" <veronika_irvine@oti.com> wrote in message
> news:cn0an4$5ml$1@eclipse.org...
>> Rather than using a mouse down listener, I think you should use the show
>> and hide listeners of the Menu. If the menu has no items then it will
>> not be shown. Also, if you want the menu to appear when the user right
>> mouse clicks on the table, you should create the menu on the table. See
>> the modified code below:
>>
>
>
>
Re: Table rightclick menu [message #446026 is a reply to message #445992] Tue, 16 November 2004 09:02 Go to previous message
Henrik Skovgaard is currently offline Henrik SkovgaardFriend
Messages: 84
Registered: July 2009
Member
Thanks for your help. As always you had an answer I could use :-)

/Henrik

"Veronika Irvine" <veronika_irvine@oti.com> wrote in message
news:cnat3u$utp$1@eclipse.org...
> Sorry my fault, the selection event comes after the menu hidden event so
> the menu items where disposed too early. Here is an improved version:
Previous Topic:Graphic library
Next Topic:how to set FileDialog's fileFilter?
Goto Forum:
  


Current Time: Wed Oct 28 23:59:46 GMT 2020

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

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

Back to the top