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.

getting the chart of a selected chartobject
 Post subject: getting the chart of a selected chartobject Post rating: 0   New post Posted: Tue 22 Nov, 2011, 12:12 
User avatar

User rating: 5
Joined: Fri 02 Sep, 2011, 10:08
Posts: 157
Location: FranceFrance
Hi,

I'm listening to chart object behaviors using ChartObjectListener.
I manage to get the selected object like this from a class implementing ChartObjectListener :

public void selected(ChartObjectEvent e) {
            IChartObject selectedObject = (IChartObject) e.getSource();
        }


But what I didn't manage to find, is how to get the current chart from which the object has been selected.
Like a selectedObject.getParentChart() or chart.getSelectedObjects()

Thanks


 
 Post subject: Re: getting the chart of a selected chartobject Post rating: 0   New post Posted: Tue 22 Nov, 2011, 12:43 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You already know from your listener that the object has been selected, so you can just check if the object belongs to the particular chart, i.e.:
chart.getAll().contains(selectedObject);


 
 Post subject: Re: getting the chart of a selected chartobject Post rating: 0   New post Posted: Tue 22 Nov, 2011, 13:04 
User avatar

User rating: 5
Joined: Fri 02 Sep, 2011, 10:08
Posts: 157
Location: FranceFrance
Thanks for the response.

In fact... quite simple !


 

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