Dukascopy
 
 
Wiki JStore Search Login

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?
 Post subject: Custom IChart context menu? Post rating: 0   New post Posted: Thu 23 May, 2013, 23:30 
User avatar

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


 
 Post subject: Re: Custom IChart context menu? Post rating: 1   New post Posted: Fri 24 May, 2013, 09:26 
User avatar

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


 
 Post subject: Re: Custom IChart context menu? Post rating: 0   New post Posted: Fri 24 May, 2013, 15:29 
User avatar

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


 
 Post subject: Re: Custom IChart context menu? Post rating: 0   New post Posted: Tue 17 Sep, 2013, 15:08 
User avatar

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=50039

HyperScalper


 
 Post subject: Re: Custom IChart context menu? Post rating: 0   New post Posted: Tue 17 Sep, 2013, 19:25 
User avatar

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. :evil:

Regards,
Kurak


 
 Post subject: Re: Custom IChart context menu? Post rating: 0   New post Posted: Mon 23 Sep, 2013, 22:52 
User avatar

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


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com