Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API function requests in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Add getSourceChart() into IChartPanelMouseEvent
 Post subject: Add getSourceChart() into IChartPanelMouseEvent Post rating: 0   New post Posted: Thu 04 Jan, 2018, 17:56 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
Hello,

I think following method is missing in
public interface IChartPanelMouseEvent {
    IChart getSourceChart();
}

Without such method there is no way in singleton (one per all charts) event handler to identify source chart of the event without tricks.
Can you add it in some of the future releases?


 
 Post subject: Re: Add getSourceChart() into IChartPanelMouseEvent Post rating: 0   New post Posted: Thu 11 Jan, 2018, 16:05 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Here is an example to get the chart object.
  
IChart chart = context.getChart(Instrument.EURUSD);
chart.addMouseListener(false, new ChartPanelMouseAdapter() {
        @Override
        public void mouseClicked(IChartPanelMouseEvent e) {
            super.mouseClicked(e);
            console.getOut().println(chart.getInstrument());
        }
});


 
 Post subject: Re: Add getSourceChart() into IChartPanelMouseEvent Post rating: 0   New post Posted: Thu 11 Jan, 2018, 16:18 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
In this example I see chart it has no direct relevance to IChartPanelMouseEvent received in mouseClicked() event.

I was saying about singleton listener for all charts, e.g.
        ChartPanelMouseAdapter singletonChartListener = new ChartPanelMouseAdapter() {
            @Override
            public void mouseMoved(IChartPanelMouseEvent e) {
                IChart chart = e.getSourceChart();
            }
        };
        for( IChart chart : context.getCharts() ) {
            chart.addMouseListener(false, singletonChartListener);
        }


 

Jump to:  

cron
  © 1998-2024 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