Questions on OOP in MQL5 - page 15

 
Vasiliy Pushkaryov:

Apologies for the misinformation, I wrote earlier that you can't call the Create() method in a child class.

Now double-checked, you can. But access to private member m_button was unavailable. I.e. it was impossible to check, for example, button's state: pressed/released.

Now with Igor's hint it's possible.

There are no problems with buttons there, I don't remember, but this class had ready methods ( not fields ) - to determine the state, if not, check IsActive() or PropFlags() or StateFlags() - there was definitely something ready to find out what's going on with the button now

I will tell you the second hack with graphics in MQL - you can find out the name of button ( Name()) and by name find it and get the state via ObjectGetInteger() and other functions, but to avoid doing it clumsily, write in your class methods to get the properties via ObjectGetInteger()


like that ;)

PS: I struggled with SB too - I couldn't find why checkboxes become selected after minimizing and maximizing the panel - as if the mouse was clicked on the object... when I realized I didn't want to re-read the whole SB, I created my own handler which, after minimizing the form, set the deselected object property for my checkboxes via ObjectSetInteger()

 
Igor Makanu:

there is no problem with battons, I don't remember, but this class had ready methods ( not fields ) - to determine the state, if not, then check IsActive() or PropFlags() or StateFlags() - exactly what was ready there to find out what is with the button now

I will tell you the second hack with graphics in MQL - you can find out the name of button ( Name()) and by name find it and get the state via ObjectGetInteger() and other functions, but to avoid doing it clumsily, write in your class methods to get the properties via ObjectGetInteger()

like that ;)

PS: I struggled with SB too - I couldn't find why checkboxes become selected after minimizing and maximizing the panel - as if the mouse was clicked on the object... when I realized I don't want to re-read the whole SB, I created my own handler which, after minimizing the form, set via ObjectSetInteger() the deselected object property for my checkboxes

I encountered this problem too. I needed to colour the dialog box in my own colours. They also turned out to be hidden in the private section. I managed to solve this problem by using a method which uses ObjectGetInteger() to paint the panels directly. And after minimizing and unfolding it was a mess too.

This is how the header looks like before it was first minimized:


And like this after.


I also couldn't find why the default colour is returned on the close and collapse buttons.

 
Vasiliy Pushkaryov:

I've encountered this too. I needed to colour the dialog box from the SB in its own colours. They turned out to be hidden in the private section, too. I managed to solve it using a method which uses ObjectGetInteger() to paint the panel directly. And after minimizing and unfolding it was a mess too.

This is how the header looks like before it was first minimized:


And like this after.


I also couldn't find why the default colour is returned on close and collapse buttons.

I took another look at the local std and was convinced of my decision to write my own library)))
 
Vladimir Simakov:
Once again I looked at the local std and was convinced of the right decision to write my library)))

I wrote about the button moment here, excerpted from there:

As long as you press the button slowly, about once a second, it works fine. Start pushing a little faster and often the event is not intercepted.

Have you noticed such problems in your library? I'd like to know if it's the SB implementation or the event handling architecture and there's no getting around it?

 
Vasiliy Pushkaryov:

... I would like to know, is this the implementation of the SB or is it the event handling architecture and there is no way around it?

You can create a button yourself as a graphical object without using the library and compare its operation with a button created with the library.

 
Dmitry Fedoseev:

You can create a button as a graphical object yourself without using the library, and compare its operation with a button created using the library.

Thanks for the idea, I'll give it a try.
 
Vasiliy Pushkaryov:

I wrote here the moment with buttons, excerpt from there:

Have you noticed such problems in your library? I'd like to know if it's the SB implementation or the event handling architecture and you can't get around it?

If you are writing for yourself (not in the Market), it's easier to make windows with buttons in C# and call from MQL .dll in C# - any fantasy with buttons, icons, checkboxes, etc. is realized in C# in half an hour - an hour, but I had to google material for a week.

The only thing you have to do is to look at the bar you've got in the Terminal directory and use it to create your own interface - it's my experience, I've learned everything I need to know about it

SZS: I just remembered, I put a simple panel in the codebase, no buttons there, but there are text labels and the code is as simple as possible. https://www.mql5.com/ru/code/25897

 
Dmitry Fedoseev:

You can create a button as a graphical object yourself without using the library and compare its performance with a button created with the library.

Yes, taken from an old job, when I wasn't working with SB, I made a kind of close button. It works quickly:


It turns out the problem is in the SB implementation.

 
Vasiliy Pushkaryov:

Yes, taken from an old job when I wasn't working with SB, I did a kind of close button. It works quickly:


It turns out that the problem is in the SB implementation.

Thestandard library implies that the controls are created on the form. They're not supposed to work at all, just like that. At least, that's how it used to be.

 
Igor Makanu:

If you are writing for yourself (not in the Market), then it's easier to make boxes with buttons in C# and call them from MQL .dll in C# - any fantasy with buttons, boxes, checkboxes, etc. can be realized in C# in an hour and a half, but I had to google material for a week.

The only thing you have to do is to look at the bar you've got in the indicators folder and use it as a base - it's much faster to create your own interface, but again, this is my experience - I've understood it that way

ZS: Yes, I remember, I put a simple panel in codebase, no buttons there, but there are text labels and the code is as simple as possible. https://www. mql5.com/ru/code/25897

No, I don't know C#.

I'll have a look at the panel, thank you.

Reason: