|
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.
| create vertical line on chart, with some extra features |
|
tcsabina
|
| Post subject: create vertical line on chart, with some extra features |
Post rating: 0
|
Posted: Sun 16 Jun, 2013, 21:14
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
|
Dear Support,
My goal is to create special vertical lines (could be a specialTime Marker as well) on the chart with the following characteristics:
1) When the user hoovers over with the mouse, it is showing a special text, as the tip (or hint). Currently the vertical line`s hint is "Vertical Line". Can I override this?
2) I want to trigger a special action when the user double-clicks on this vertical line (or Time Marker). Currently double-clicking on vertical line activates edit mode of the line, where you change position, width, color, etc. How can I override this again?
How can I do this, if possible at all? If the vertical line object type is not good choice for such requirements, could you give me some tips about how to achieve what I am looking for?
Thanks.
|
|
|
|
|
 |
|
API Support
|
 |
Post subject: Re: create vertical line on chart, with some extra features |
Post rating: 0
|
Posted: Mon 17 Jun, 2013, 07:58
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
tcsabina wrote: 1) When the user hoovers over with the mouse, it is showing a special text, as the tip (or hint). Currently the vertical line`s hint is "Vertical Line". Can I override this? Have you tried IChartObject.setTooltip? tcsabina wrote: 2) I want to trigger a special action when the user double-clicks on this vertical line (or Time Marker). Currently double-clicking on vertical line activates edit mode of the line, where you change position, width, color, etc. How can I override this again? See: https://www.dukascopy.com/wiki/#Handle_chart_object_events
|
|
|
|
|
 |
|
tcsabina
|
| Post subject: Re: create vertical line on chart, with some extra features |
Post rating: 0
|
Posted: Mon 17 Jun, 2013, 09:37
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
Quote: Have you tried IChartObject.setTooltip? Shame on me that I haven`t... Quote: Looks promising. Is this a new page in the wiki? I was browsing the wiki upside-down in the last couple of days to get a grep of chart object, how could I missed it? Thanks again for the fast support!
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: create vertical line on chart, with some extra features |
Post rating: 0
|
Posted: Mon 17 Jun, 2013, 10:42
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
tcsabina wrote: Is this a new page in the wiki? I was browsing the wiki upside-down in the last couple of days to get a grep of chart object, how could I missed it? It is there already for more than a year  .
|
|
|
|
|
 |
|
tcsabina
|
| Post subject: Re: create vertical line on chart, with some extra features |
Post rating: 0
|
Posted: Tue 25 Jun, 2013, 23:14
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
|
A follow up question on this: When I double-click on a line, the method selected() is called. This is fine, however I want to avoid that the chart object is changed into an `edit` mode (top, middle, bottom there is a circle; and the cursor changes to a + sign). Is there a way to avoid this visual change of the line?
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: create vertical line on chart, with some extra features |
Post rating: 0
|
Posted: Wed 26 Jun, 2013, 13:47
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
No it is not possible. Only uneditable chart objects don't have edit control points (see IChartObject.setLocked). But you can't select uneditable chart objects (i.e. the select event won't fire when you double-click such object), you can only catch the highlighted event for such objects.
|
|
|
|
|
 |
|
tcsabina
|
| Post subject: Re: create vertical line on chart, with some extra features |
Post rating: 0
|
Posted: Sun 07 Jul, 2013, 21:09
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
|
After some testing it seems that I could achieve with a workaround to not to make visible changes on the chart object when the user selects it. And this workaround would be if I fire a mouse click, or hit enter. Whenever a chart object is in an edit mode, if I click somewhere else on the chart, or hit Enter, the edit mode closes.
How could I fire an Enter key (or a mouse click) in the selected() event?
|
|
|
|
|
 |
|
tcsabina
|
| Post subject: Re: create vertical line on chart, with some extra features |
Post rating: 0
|
Posted: Sun 07 Jul, 2013, 21:24
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
I quickly came up with this: public void selected(ChartObjectEvent e) { .... try { Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_SHIFT); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); } catch (AWTException ex) { ex.printStackTrace(); } }
Enter closes the edit mode. The mouse click resets the mouse pointer (from the + sign, which is the edit mode's mouse pointer). Any drawbacks of this?
|
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|