i have create some objects on chart. but if i press the backspace button on keyboard. these objects will be deleted on chart.
how can i disable this event . thanks .
OK, I'm guilty of resurrecting this thread (and then removing my post as I thought I shouldn't really be resurrecting old threads).
Unfortunately, backspace doesn't care if the object is selected or not. It will always delete the last object created.
As the thread is alive again (sorry!) I'll repost my solution:
The keystroke chartevent fires before the object gets deleted.
So the solution is to create a sacrificial object to be deleted.
This effectively inhibits backspace for the entire chart.
void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam)
if(id==CHARTEVENT_KEYDOWN && lparam==8) ObjectCreate(0,"Nothing",OBJ_LABEL,0,0,0);
Unfortunately you cannot set backspace as a hotkey in the terminal to fire a script.
So the only solution (that I am aware of) is to have something running on the chart that can detect the backspace keystroke and create the sacrificial object before the delete gets actioned.
No, I'm going with Ovo on this. It will delete objects that are not selected.
Drop this script onto a chart. Then make sure you click in the chart window to get the focus, and press backspace. Goodbye object!
In addendum to my last, I can't recreate your animated gif.
This is what I believe you are doing:
Your result: the first object (the selected one) is deleted
My result: the second object (the unselected one) is deleted.
Which build are you using?