expert advisor - miscellaneous questions - page 37

 

#Object Mixed - Open

I already few times asked about this issue I did not get good answers.
And I already tried to find solution on SEO. Nothing there for my this issue (it's possible cause is my limitedly English)... and then I decided I could ask once again about that issue with more clearly describes ( I hope I do so... ).

So that is why I write example code that coder and programmer easily understand my issue.

Note: both objects parameters could be like below.

ObjectCreate(0,"Button",OBJ_BUTTON,0,0,0);
ObjectSetString(0,"Button",OBJPROP_TEXT,"Click -");
ObjectSetInteger(0,"Button",OBJPROP_XDISTANCE,100);
ObjectSetInteger(0,"Button",OBJPROP_YDISTANCE,20);
ObjectSetInteger(0,"Button",OBJPROP_XSIZE,80);
ObjectSetInteger(0,"Button",OBJPROP_YSIZE,30);
ObjectSetInteger(0,"Button",OBJPROP_CORNER,CORNER_RIGHT_UPPER);
ObjectSetInteger(0,"Button",OBJPROP_COLOR,clrWhite);
ObjectSetInteger(0,"Button",OBJPROP_BGCOLOR,clrGray);
ObjectSetInteger(0,"Button",OBJPROP_STATE,false);
ObjectSetInteger(0,"Button",OBJPROP_BACK,false);
ObjectSetInteger(0,"Button",OBJPROP_SELECTABLE,false);
ObjectSetInteger(0,"Button",OBJPROP_SELECTED,false);
ObjectSetInteger(0,"Button",OBJPROP_ZORDER,1);

ObjectCreate(0,"Hline",OBJ_HLINE,0,0,WindowPriceMax() - ( 40 * Point ));
ObjectSetInteger(0,"Hline",OBJPROP_COLOR,clrBlue);
ObjectSetInteger(0,"Hline",OBJPROP_BACK,false);
ObjectSetInteger(0,"Hline",OBJPROP_ZORDER,0);

#msissue - button hline mixed

Thanks in advance.

 
But what is the issue?
 
Marco vd Heijden:
But what is the issue?
When I need to click Button Object, also Hline Object turn to selected mode.
 
ObjectCreate(0,"Button",OBJ_BUTTON,0,0,0);
ObjectSetString(0,"Button",OBJPROP_TEXT,"Click -");
ObjectSetInteger(0,"Button",OBJPROP_XDISTANCE,100);
ObjectSetInteger(0,"Button",OBJPROP_YDISTANCE,20);
ObjectSetInteger(0,"Button",OBJPROP_XSIZE,80);
ObjectSetInteger(0,"Button",OBJPROP_YSIZE,30);
ObjectSetInteger(0,"Button",OBJPROP_CORNER,CORNER_RIGHT_UPPER);
ObjectSetInteger(0,"Button",OBJPROP_COLOR,clrWhite);
ObjectSetInteger(0,"Button",OBJPROP_BGCOLOR,clrGray);
ObjectSetInteger(0,"Button",OBJPROP_STATE,false);
ObjectSetInteger(0,"Button",OBJPROP_BACK,false);
ObjectSetInteger(0,"Button",OBJPROP_SELECTABLE,false);
ObjectSetInteger(0,"Button",OBJPROP_SELECTED,false);
ObjectSetInteger(0,"Button",OBJPROP_ZORDER,1);

ObjectCreate(0,"Hline",OBJ_HLINE,0,0,WindowPriceMax() - ( 40 * Point ));
ObjectSetInteger(0,"Hline",OBJPROP_COLOR,clrBlue);
ObjectSetInteger(0,"Hline",OBJPROP_BACK,true);
ObjectSetInteger(0,"Hline",OBJPROP_ZORDER,0);
 
Marco vd Heijden:

Still when I click Button object, Hline object selected.

Thanks a lot.

 

When you set:

ObjectSetInteger(0,"Hline",OBJPROP_BACK,true);

The line will be behind the button.

But you are right it still get selected.

So depending on if the line needs to be manually adjusted you can add:

ObjectSetInteger(0,"Hline",OBJPROP_SELECTABLE,false);
 
Marco vd Heijden:

Sorry, but sometimes I need to select " Hline ".
It's very important for me.

When I click Button object if Hline will selected it's very dangerous for me. 

 

Then you have to drag the vertical scale a bit so that the line comes out from underneath the button.

The button takes just one click where the line takes two so if you are really annoyed by it you can start a counter that sets the line as fixed for a short amount of time, after the button has been pressed.

 
Marco vd Heijden:

The button takes just one click where the line takes two so if you are really annoyed by it you can start a counter that sets the line as fixed for a short amount of time, after the button has been pressed.

Once I already asked about that in my other subtopic's - but I think it won't be useful for me.
I have idea but I do not know how can I do that - but I know for sure I will try something for it. Because I think it's more safe way then this one.

Thanks for your comments.

( I will start to research about my idea soon - I hope I will do it by myself... )

 

In the code that is executed when the button is clicked, include the code

ObjectSetInteger(0,"Hline",OBJPROP_SELECTED,false);
that way if you select the line when clicking the button, it will automatically be de-selected.
Reason: