How to check if an order is selected

 

What is the best way to check if an order is currently selected?

This is particularly useful for many functions which work with orders so that the current order selection is remembered when the function starts and is restored when the function finishes, so that the order selection does not go astray because of the execution of the function (this sometimes leads to hard to detect errors).

If we do the following:

void SomeFunc()

{

int tick=OrderTicket();

// .....

if(tick>0) OrderSelect(tick,SELECT_BY_TICKET)

}

On the first line an error 4105 will be generated if the current order is not selected, which of course is undesirable. If we clear the last error before that and check after that, the information about the last error will be cleared, which is also undesirable, if the last error should be analyzed later in some particular code fragment.

How can we solve this problem without generating error 4105 if the current order is not selected?

 
Have you heard of the construct if(OrderSelect(ticket,SELECT_BY_TICKET)){}?
 
FAQ:
Have you ever heard of if(OrderSelect(ticket,SELECT_BY_TICKET)){}?

The ticket is unknown, have you even looked into the question?

 

then what is it ???

int tick=OrderTicket();

 
that's what she's going to give you back fouls
 
FAQ:

then what is it ???

This is what generates error 4105 if the order is not selected, the task is to avoid generating this error but still know the ticket of the order if it is selected before

 
the answer is: select an order first.
 
FAQ:
answer: select the order first.

How can I select an order if I don't know its ticket?

 

In short, dear FAQ, either try to understand the question or don't write in vain

 
by the number in the loop.
 
Ant_TL:

In short, dear FAQ, either try to understand the question or do not write in vain


Dear, if you had a little bit of mind in your head, you would have realized that :

1) Your question is essentially meaningless.

2) Don't be rude, especially when someone is trying to help you.