GLUCK?! Mouse click event handling!!! - page 4

 
use on_MouseDown instead of on_Click
 
FAQ:
Use on_MouseDown instead of on_Click
Thank you very much.
 

THANK YOU THANK YOU THAT the problem was solved in a fairly quick way.

I like this language even better!!!!

 
Vladon:

THANK YOU THANK YOU THAT the problem was solved in a fairly quick way.

I like this language even more!!!!

Enlighten

ZS. Had a quick look at the possible events and immediately had a few thoughts on the matter. Interesting confirmation.

 

I have a small panel too.

It works by clicking on an object and you additionally need to press CTRL as "childproofing".

Once pressed, the buttons are set to false.

if(id==CHARTEVENT_OBJECT_CLICK && key==true)
     {
      if(sparam=="buy")  {Print("Нажата BUY");OpenBuy();} 
      if(sparam=="sell")  { Print("Нажата SELL");OpenSell(); }  
      if(sparam=="wl")  { Print("Нажата WL");ModifyWl();}
      if(sparam=="sellstop")  { Print("Нажата SELL STOP");SellStop();}  
      if(sparam=="buystop")  { Print("Нажата BUY STOP");BuyStop();}
      if(sparam=="delpend")  { Print("Нажата DELETE");DelPend();}
     
      ChartRedraw();
     }
  if(id==CHARTEVENT_KEYDOWN)
     {
       if(lparam==KEY_CTRL) {key=true;} else {key=false;}
     }
 // востановим кнопки
 graf_button("buy",270,5,clrBlue,"BUY",12,3,false);
 graf_button("sell",210,5,clrCrimson,"SELL",12,3,false);
 graf_button("wl",150,5,clrBlack,"WL",12,3,false);
 
 graf_button("buystop",270,30,clrDarkBlue,"B.STOP",12,3,false);
 graf_button("sellstop",150,30,clrCrimson,"S.STOP",12,3,false);
 graf_button("delpend",210,30,clrBlack,"DEL",12,3,false);
 
Karlson:

I have a small panel too.

It works by clicking on an object and you additionally need to press CTRL as "childproofing".

Once pressed, the buttons are set to false.

I see, that's how I started: http://codebase.mql4.com/ru/6091

then like this: https://www.mql5.com/ru/code/223/

then like this: https://www.mql5.com/ru/market/product/332

ZS, no. this is not an advertisement. do not throw it at me. I just got a kick out of it and went from 2 links to 3 literally overnight. Interesting opinion.

It's not because I'm greedy. I need the money. The kids are small, the demands are big. Who am I to say. Everyone's in that position.

FAQ:

Enlighten

ZS. Had a quick look at possible events and immediately had a few thoughts on the matter. Interesting confirmation.

I haven't used any add-on libraries because I don't like them. !!!! To be honest I didn't write it to get the full code, just a kick in the pants, like always :-)

I used the usual

CHARTEVENT_MOUSE_MOVE

And it has a left button pressed state, in the 3 parameter gives out 1, if the button is pressed.

Determine the location of this coordinate and compare it with the coordinate of the button pressed - 1 class.

I just didn't think the MKL5 language was so advanced.

 

Now I'm working on dragging the panel, and dragging is not like most panels - you press the button, then a small square which is not even visible - you drag it then release the button - and then everything is redrawn.

I made the whole panel drags behind the cursor until it is not squeezed, but how the hell to make it no longer drags when you click on the button? :-)

I guess you could say ::

Yup it's easy :-)

not easy :-) and the whole problem is that it can't handle two snappers at the same time.

 
Vladon:

Now I'm working on dragging the panel, and dragging is not like most panels - you press the button and then for a small square which is not even visible - you drag it and then release the button - and then everything is redrawn.


not easy :-) but the problem is that it can't handle two sobytes at the same time.

Maybe it's easier to use the Standard Library? Look at an example - Controls.mq5 from MQ.
Документация по MQL5: Стандартная библиотека
Документация по MQL5: Стандартная библиотека
  • www.mql5.com
Стандартная библиотека - Документация по MQL5
 

Vladon:

I've made the whole panel drag behind the cursor until it's released, but how the hell do I make it stop dragging again when I press the button? :-)

Which button are we talking about?
 
sergeev:
which button are we talking about?

left mouse button I was referring to.

Yurich:
Maybe it's easier to use Standard Library? Look at an example - Controls.mq5 from MQ.

Everyone says so, but why should I, a programmer, use the standard library? :-)

For example, the bug with accidental left mouse button click when dragging a chart, I solved with 2 lines of standard functions, while the library contains 1000 lines of code.

I'm not arguing - standard libraries might be more profitable to use. But I prefer an easily accessible way, and not to bother with Include additional libraries.

Reason: