Login Page - Create Account

Support Board


Date/Time: Fri, 27 Dec 2024 02:22:02 +0000



How to see is the user drawing 'selected' or not ?

View Count: 1853

[2016-02-19 11:09:28]
User921987 - Posts: 238
I am using the GetUserDrawnChartDrawing() function to find lines on my chart. I can find and modify them without any problems.

But how can I see is the found line (s_UseTool) selected by the user (left mouse button pressed above the line) ?
Date Time Of Last Edit: 2016-02-19 11:33:31
[2016-02-19 23:55:35]
Sierra Chart Engineering - Posts: 104368
Not totally sure what you are asking about here, but refer to this documentation here for receiving Pointer events in an ACSIL function:
https://www.sierrachart.com/index.php?page=doc/doc_MouseAndMenuInteractionFromACStudy.html
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
[2016-02-20 08:32:56]
User921987 - Posts: 238
Thank you for the information. I allready have read the help files and was not able to find the answer for my question (or did not understand the way).

So the case is this:

1.
I draw 3 vertical lines on the chart
2.
Then I select one of them by mouse (left click) -> the small dots will appear to it to show me that I have seleceted this line.
3.
Now I will press the Custom Study Button in the Control Bar which will throw events for my Custom Study which is attached to the chart.

What this Custom Study does is that it will loop through those lines on the chart but how do I find out which one of those lines is the one I have selected by the mouse (I would like to target the actions in my custom study only for that selected one) ?

First I though you have a 's_UseTool' member variable which will tell is the drawing selected or not but didn't find any. So is there any other way to find out is the drawing selected or not ?

Or am I trying to do this by wrong method and I should use the "right click above the wanted line" method and then using menus and mouse cursor position information ?
Edit: No this is not a solution because the ACSIL added shortcut menu entries are not shown if the right click is done above the line it should be done elsewhere and this leads often to a situation where the code cannot be sure what is the user's target line for the command... ;(

If this information is not available (is the s_UseTool selected or not) this can be done in another way by pointer events: For example first selecting the button (command) and then pointing the line but I see this is more complicated for the user because you have to remember to do the inactivation for the command. Would be less stress/easier by the selection method where the user just press the button for execution. Also if there is multiple lines close to each other it sometimes may be a bit tricky to choose the right one (have to zoom in more and this makes more hassle).
Date Time Of Last Edit: 2016-02-21 08:51:20
[2016-02-20 17:10:46]
User921987 - Posts: 238
The thing solved.

The information is in sc.ActiveToolIndex variable.

Thanks ;)
[2016-02-26 08:46:16]
User921987 - Posts: 238
sc.ActiveToolIndex does not allways update when I select a line (drawing) by left clicking it.

I have to update the line's position for example by moving it 1 bar ahead and then back to it's position until I can read the correct Active Tool Index value.

Another way is to open the line's chart drawing properties to get the drawing to get a focus and the sc.ActiveToolIndex to update it's value. But for some reason this method does not work allways...

Any possibility to change this behaviour so that when I just "select" the line (by left clicking it) the sc.ActiveToolIndex would start to point into that line ?

IMO this would be a logical behaviour and should improve the usage because then I do not have to do any additional tricks to get the code work.

Or is there something what I do not understand right ?
Date Time Of Last Edit: 2016-02-26 08:59:04
[2016-02-26 09:23:34]
Sierra Chart Engineering - Posts: 104368
When you select a Line, what tool is checked under the Tools menu?
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: 2016-02-26 09:23:44
[2016-02-26 09:30:58]
User921987 - Posts: 238
Pointer, Chart Values/Crosshair or Hand.

The situation is that I allready have some vertical lines on the chart and then I would like to select one of them and then the code should know what is selected so it can handle it...
Date Time Of Last Edit: 2016-02-26 09:31:30
[2016-02-26 09:45:03]
Sierra Chart Engineering - Posts: 104368
Make sure you have set sc.ReceivePointerEvents = 1 in the study function.
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
[2016-02-26 11:02:14]
User921987 - Posts: 238
Thank you for the suggestion but did not give any help.

---

Please see attached files about the situation as follows,

1. test.cpp
The code of our test study
2. chart.gif
The starting situation on the chart. There is 3 vertical lines and their index can be seen from the text field
3. selected.gif
This is what happened when I did a select by the mouse (left click). The small dots are telling me the line is "selected".
4. log1.gif
Then I pressed a user confugred button and here is what happened on the log
5. selected2.gif
Here I tried to select another line.
6. log2.gif
Again I pressed the user button and the log was updated

So at this point we can clearly see the sc.ActiveToolIndex does not update it's value

7. log3.gif
NOW I selected the line again and moved it from it's position to the next bar and then I moved it back to it's original position and then I pressed the user button again and here you can see the log is telling us now sc.ActiveToolIndex is updated correctly.
attachmenttest.cpp - Attached On 2016-02-26 10:52:31 UTC - Size: 845 B - 456 views
imagechart.gif / V - Attached On 2016-02-26 10:52:41 UTC - Size: 17.34 KB - 320 views
imageselected.gif / V - Attached On 2016-02-26 10:52:51 UTC - Size: 18.59 KB - 313 views
imagelog1.gif / V - Attached On 2016-02-26 10:53:00 UTC - Size: 4.78 KB - 303 views
imageselected2.gif / V - Attached On 2016-02-26 10:53:05 UTC - Size: 18.67 KB - 319 views
imagelog2.gif / V - Attached On 2016-02-26 10:53:12 UTC - Size: 10.21 KB - 321 views
imagelog3.gif / V - Attached On 2016-02-26 10:53:16 UTC - Size: 11.46 KB - 307 views
[2016-02-26 18:38:03]
Sierra Chart Engineering - Posts: 104368
Do not provide us any further information. What you have provided goes far beyond the scope of our support and we did not request it.

We will look this over when we have time and see what can be done but do not provide us any further information. Once again we did not ask for this information.

At this time, consider what you are doing as unsupported. We will see how we can help, but we are quite busy. We are not sure how soon we can get to this.
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: 2016-02-26 18:41:07
[2016-02-26 20:07:13]
Sierra Chart Engineering - Posts: 104368
We need time to look this over. We do not need any further information. It is not considered a bug.

What you are trying to do is not considered the typical use of sc.ActiveToolIndex

Also selecting a line is not considered an event that a study will be notified about when using sc.ReceivePointerEvents = 1;
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: 2016-02-26 20:11:10
[2016-02-26 22:28:51]
Sierra Chart Engineering - Posts: 104368
There is no harm, we just have a lot to do and we do not want to be overwhelmed with unnecessary information. We are going to be looking into this. There is no other place to post the information other than here.

We also made a mistake with what we originally saw. After we looked over the information again, we understand what you are trying to show and we saw the study function was simple so we can work with that.
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
[2016-03-01 13:29:18]
Al SC Developer - Posts: 434
You can not just blindly use sc.ActiveToolIndex on an ACS button press, because it likely no longer contains the original point you were interested in. This is because the value is updated with mouse movement and clicks (it changed as you moved to your button).

The interface is designed so that you first enter into ACS tool mode by selecting your button, and then monitor for mouse events. Then when you see the SC_POINTER_DOWN event, you can record the value of sc.ActiveToolIndex on each mouse click and then continue with your processing.

Currently, the selection state of a drawing is not provided in the UseTool struct.
[2016-03-01 14:22:10]
User921987 - Posts: 238
I was lucky to get the selection state to work by adding the sc.ReceivePointerEvents = 0 and selecting the target by moving it before the action ;) So if someone is needing this feature it can be done.

But now after your explanation I think I am going to change my implementation to "command first" method.

Thank you very much for your support.
Date Time Of Last Edit: 2016-03-01 14:24:20

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

Login

Login Page - Create Account