|
Attention! Read the forum rules carefully before posting a topic.
Try to find an answer in Wiki before asking a question. Submit programming questions in this forum only. Off topics are strictly forbidden.
Any topics which do not satisfy these rules will be deleted.
Custom IChart context menu? |
hyperscalper
|
Post subject: Custom IChart context menu? |
Post rating: 0
|
Posted: Thu 23 May, 2013, 23:30
|
|
User rating: 98
Joined: Mon 23 Jul, 2012, 02:02 Posts: 656 Location: United States, Durham, NC
|
Through the API in standalone mode, can I create a custom Right Mouse Click Context Menu JPopupMenu of action items on an IChart ?
Thanks ! HyperScalper
|
|
|
|
 |
kurak777
|
Post subject: Re: Custom IChart context menu? |
Post rating: 1
|
Posted: Fri 24 May, 2013, 09:26
|
|
User rating: 7
Joined: Fri 13 Jan, 2012, 20:49 Posts: 94 Location: Poland, Warsaw
|
Hi, It is fairly easy. You can add mouselistener to IChart and receive JPanel object of the chart from IClientGUI. I do it in following way: public void addContextMenu(IClientGUI clientGUI) {
final JPanel chartPanel = clientGUI.getChartPanel(); final JPopupMenu menu = new JPopupMenu("chartContextMenu");
IChart chart = clientGUI.getChart();
JMenuItem item1 = new JMenuItem("item 1"); menu.add(item1);
chart.addMouseListener(true, new IChartPanelMouseListener() { @Override public void mouseClicked(IChartPanelMouseEvent e) { if (e.getSourceEvent().getButton() == 3) { menu.show(chartPanel, e.getSourceEvent().getX(), e.getSourceEvent().getY()); } }
@Override public void mousePressed(IChartPanelMouseEvent e) {} @Override public void mouseReleased(IChartPanelMouseEvent e) {} @Override public void mouseEntered(IChartPanelMouseEvent e) {} @Override public void mouseExited(IChartPanelMouseEvent e) {} @Override public void mouseDragged(IChartPanelMouseEvent e) {} @Override public void mouseMoved(IChartPanelMouseEvent e) {} }); } Best regards, Kurak
|
|
|
|
 |
hyperscalper
|
Post subject: Re: Custom IChart context menu? |
Post rating: 0
|
Posted: Fri 24 May, 2013, 15:29
|
|
User rating: 98
Joined: Mon 23 Jul, 2012, 02:02 Posts: 656 Location: United States, Durham, NC
|
Thanks ! I'll try this. Also hoping we can can an API update soon ... HyperScalper
|
|
|
|
 |
hyperscalper
|
Post subject: Re: Custom IChart context menu? |
Post rating: 0
|
Posted: Tue 17 Sep, 2013, 15:08
|
|
User rating: 98
Joined: Mon 23 Jul, 2012, 02:02 Posts: 656 Location: United States, Durham, NC
|
Hey kurak, Is this method continuing to work for you with API 2.8.0 and higher? My post indicates that it may not continue to work?.... viewtopic.php?f=65&t=50039HyperScalper
|
|
|
|
 |
kurak777
|
Post subject: Re: Custom IChart context menu? |
Post rating: 0
|
Posted: Tue 17 Sep, 2013, 19:25
|
|
User rating: 7
Joined: Fri 13 Jan, 2012, 20:49 Posts: 94 Location: Poland, Warsaw
|
I can just confirm that it stopped working also on my side starting version 2.8. Regards, Kurak
|
|
|
|
 |
hyperscalper
|
Post subject: Re: Custom IChart context menu? |
Post rating: 0
|
Posted: Mon 23 Sep, 2013, 22:52
|
|
User rating: 98
Joined: Mon 23 Jul, 2012, 02:02 Posts: 656 Location: United States, Durham, NC
|
kurak777 wrote: I can just confirm that it stopped working also on my side starting version 2.8. Thanks, well I'm counting on them to make it possible for us to have a supported Context Menu implementation. I have a real need for that in my app right now. HyperScalper
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|