Login Page - Create Account

Support Board


Date/Time: Fri, 29 Mar 2024 05:09:41 +0000



programmatically getting the currently selected drawing on the chart

View Count: 1123

[2018-03-25 09:29:00]
User735389 - Posts: 188
Here's the use case:

1. I select a drawing on the chart
2. I right click to bring up the menu option
3. I select one of the options in the menu
4. Some action is performed on the selected drawing
[2018-03-25 13:10:49]
WarriorTrader - Posts: 245
DrawingObject.AddAsUserDrawnDrawing = 1; should do the trick, but make sure you also have the ChartNumber set.

-WT
NOT SC support
[2018-03-26 05:03:33]
Sierra Chart Engineering - Posts: 104368
In the next release we are going to add a new member to the s_UseTool structure named IsSelected which you can then use to determine if the drawing is selected.

You still have to iterate through the user drawn drawings to find the appropriate one but at least this is a help. We will see about adding a separate function to get a selected drawing but there can be more than one drawing selected.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2018-03-26 05:04:30
[2018-03-26 08:43:12]
User735389 - Posts: 188
ok great, that'll work
[2018-04-02 17:55:47]
User735389 - Posts: 188
So this feature worked as described, thanks. The one problem I have is if the drawing was created from another chart, then I can't determine the lasted selected drawing between all the charts (which should always be my target drawing). A simple solution I can see is to add a 'selected timestamp' property to the drawings. That way I can iterate through all the drawings through all the charts and find the last selected drawing. Perhaps there's another way to iterate through the chart drawings to include all drawings shown on the chart (not just the drawings that were created from this chart)? Please advise, thanks.
[2018-04-02 18:25:39]
User735389 - Posts: 188
From a quick test, it appears my understanding of how drawings and this property was incorrect. The IsSelected property only works when the drawing is selected from the chart it was created from. So my proposed solution will not work. I'm using sc.GetUserDrawnChartDrawing to iterate through all the drawings. Please advise.
[2018-04-02 19:20:00]
WarriorTrader - Posts: 245
From a quick test, it appears my understanding of how drawings and this property was incorrect. The IsSelected property only works when the drawing is selected from the chart it was created from. So my proposed solution will not work. I'm using sc.GetUserDrawnChartDrawing to iterate through all the drawings. Please advise.


You can draw another tool on the desired chart via code then use c.GetUserDrawnChartDrawing on the second chart for a second time to find the new tool. I do something similar although for a different reason.


--WT
NOT SC support

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account