Creating a graphic library from scratch

 
sabre
 

Forum on trading, automated trading systems and trading strategy testing

Crowdsourced GUI. Open beta-testing.

Alexey Barbashin, 2020.03.07 21:25

"but maybe it's easier to do everything in objects" - this is more than logical

"Yes of course we'll partially rely on it." - then right away we are corrected:

class CCoordPBase

Наследуемся от CObject, то есть:

class CCoordPBase : public CObject

Хотя наверное можно и по другому:

class Control : public CObject

CObject is the base class of all objects in the developers library. Made by analogy with C++ and C#. The base object (type) in Sharp is Object.

Coordinates and dimensions are properties of the control, as well as border colour, colour and thickness, radiuses of roundings, icons and text.

We first have to define what kind of control is elementary and then describe the basic properties.

Of course, some of the previously defined properties may not be used in the descendants, it's not a problem, but it's better to make the basic one the most versatile.

Here is an example of a simple universal control:

Contains background, border, radius, icon, text

If you need a Label, you don't specify background, border and icon; if you need a Panel, the contents are not specified; if you need an image button, only icon is specified; if you need a button with an image, the background, border and image are specified.

That is, this composition is pretty universal for most controls.


I see, the question about changing style by hovering over it while keeping coordinates... although it's kinda clear already

Is there a standard biliotec by control ?

 

The essence ofCObject is to type all objects.

For example, we need a list library (list of items, combo box, checklist, and so on). For each type of elements we can create a different type of array, as Anatoly did, or you can use a ready-made tool:CArrayObj

That is, many pieces of code don't need to be invented, they are already there, just take them and use.

 
Alexandr Andreev:

I understand that, the question is about changing the style on hovering while keeping the coordinates... although it seems to be clear already

Is there a standard bilio on the control?

The standard library from developers can be taken as a basis, I don't see anything embarrassing in it, their hierarchy.

Of course from there we should throw out everything related to direct construction, but leave the system of transferring events - it's really universal!

With this technology, no matter which class even the most complex control will belong to, events will be passed through the elementary object's typed system.

The basic control will be drawn in the underlying CControls, after which the OnPaint() event will be generated. This will allow the user to redraw/redraw the child controls and generally allow the user to redraw the control however they wish.

 
Alexandr Andreev:

Come on!!!!!

and I was thinking of making a simple interaction

where we're going to enter positionings, like to the left of the previous object in case of line or column

So we'll write a universal controller

That's exactly how it should be done: write the elementary interaction.

A basic controller at the very beginning doesn't have to have all the necessary properties, just a background is enough.

After all, in order to render the control itself, it will contain the corresponding function. So, when adding any properties, we will have to modify only one function.

According to the elements hierarchy?

CObject is a basic type

class CControl : public CObject - the base control of the library itself

class CContainerControl : public CControl - the group control. One of its fields will be an array of nested controls. You can see an example inthe CWndContainerstandard library.

 
Sasha, since you have already started coding, make an open source project in MQL. Who knows, maybe there will be some.
 
Алексей Барбашин:
Sasha, since you've already started coding, make an open source project in MQL, you'll be able to develop it together and share it with the others. Who knows, maybe there will be some.

I'm on hold for now... looking at the standard libraries.... there's a lot of unnecessary stuff

I don't know if there are many of them, but it would be better to write your own kontrol... or inherit

CChartObject

Документация по MQL5: Стандартная библиотека
Документация по MQL5: Стандартная библиотека
  • www.mql5.com
Стандартная библиотека MQL5 написана на языке MQL5 и предназначена для облегчения написания программ (индикаторов, скриптов, экспертов) конечным пользователям. Библиотека обеспечивает удобный доступ к большинству внутренних функций MQL5.
 
Алексей Барбашин:
Sasha, since you've already started coding, make an open source project in MQL. Who knows, maybe there will be some.

I think it's a bit early to start from scratch, we need to build something up first

 
Alexandr Andreev:

I'm on hold for now... looking at the standard libraries.... there's a lot of unnecessary stuff

(although not much))) but you'd better write your own control... or you can inherit it

CChartObject

No, no!!!

Watch closely!

This controller is just the way to nowhere! We don't need discrete chart objects! We need to draw on canvas - that's the only way to get development and wider possibilities.

And the fact that you have to make your own main controller - that's for sure.

The standard library divides properties and states between CWndObject and CWnd, while we need to unite everything in one control.

 
Алексей Барбашин:

No, no!!!

Watch closely!

This controller is the way to nowhere! We don't need discrete chart objects! We need to draw on kanvas - that's the only thing that will give us development and wide possibilities.

And the fact that you have to make your own main controller - that's for sure.

The properties and states in the standard library are split between CWndObject and CWnd, and we need to unite all in one control.

I spent a quarter of an hour trying to create a project and it turned out to be created, now I'm looking at how to make it public

 
Alexandr Andreev:

I think it's a bit early to start with a clean slate.

I'm sure it's not a good idea to start from scratch.

Very clever people have spent a lot of time and knowledge to make the same standard library or Anatoly's library.

People spent time and knowledge and it would be foolish not to use it.

We should just take the best, from our point of view, in both and build a new one.

We need to learn from other people's mistakes. We will make our own.)