Creating a graphic library from scratch - page 15

 
Otherwise, it's great, keep going.
 
For you, it's very easy to create controls on kanvas:

1. Take out several drawing functions from the kanvas class, namely vertical line, mountain line. rectangle, filled rectangle, text.

2. To draw each element, write a function: void Button(), void Checkbox()... etc.

3. In the function of drawing elements you include sets of calls to drawing functions (lines, rectangles), with which you "draw" the structure of required control on the required canvas.

4. an instance of each created element should be bound to its window.

5. The properties of each created instance (text X, Y, X_SIZE, Y_SIZE...) should be saved in an array or structure for other functions to read/change them.

And then you will follow the same path ....)

And all this on canvas, mind you.

 
What if you need other objects that might be underneath the object that is drawn on the main background?
 
Aliaksandr Hryshyn:
What if you need other objects that can be underneath the object that is drawn on the main background?
Give an example. There are many different situations with different solutions.
 
Реter Konow:
Give me an example. There are many different situations with different solutions.

In my situation, a canvas would probably suffice, I think I'll do as you advised.

Especially since there is already minimal support for kanvas
 
Each window is a separate, independent canvas.

Creating a window is as simple as the other elements:

1. the window has simple basic properties of several regular rectangles that are consistently drawn on the created canvas by calling the FilledRectangle() function (from CCanvas class) and passing template or usable values to them.

2. the window is drawn before its elements. This is done using special function Draw_window(x, y, w, h); for example, it calls FilledRectangle() required number of times to build window structure.

3. Then, functions are called to draw the controls. Each is constructed similar to a window, with a series of rectangles and frames drawn one at a time.

4. The properties of each instance of each element created by the function call are written to any memory option available to the other functions, among which:

A function that catches the event of finding the cursor above the coordinates of the drawn element, which on each cursor move event does a loop through the coordinates of all the drawn and drawn elements in that window and finds the one directly below it.

A function which fixes the event of pressing/repressing on the element under the cursor and switches its state (if it's interactive) by calling another function which changes the values of that element's parameters (colour, icon...) and redraws it again.

That's enough for a start.

 
Roman:

For HFT, I think 3D would be useful in creating a graphical analysis of the cup volume and order flow.
But how to interpret such information, I have not delved into.

where is it available ?

 
There are several categories of controls, among which we can distinguish two main ones:

1. Decorative - lines, frames, rectangles, icons...

2. "Parametric" - i.e. having a parameter.

The second type is represented by two subcategories:

1. input elements - provide the possibility to change the value with graphical "mechanisms" designed for different types of parameters. These elements are divided into several groups, for example the logic state true/false (bool) sets the button, checkbox and radio button, and the value of the parameter with the boundaries of the range and step is controlled by a slider or input field. For each type of parameter there are several elements of the same type that allow to change its value in a similar way.

2. output elements - they translate the value in numeric, text or other graphically transformed form. These include: table cells, text labels, progress bars. Indicators and graphs also belong to this category, and their difference is only adaptability to a large volume of output data.


As I said earlier, drawing elements is simple and uncomplicated. In fact, it's just a matter of marking up an array with values. All the functions are in the CCanvas class - lines, rectangles, frames. The functions only need to pass the array, which is then stored in the resource and connected to the BITMAP_LABEL object using the OBJPROP_BMPFILE property.

The wrapper of this class disturbs me like a dog's fifth leg. (That must be why no one has ever created libraries on Canvas because they have been told from above: "You must ride the cow with a saddle only! ;)).