Making a crowdsourced project on Canvas - page 8

 
o_O:

OK.

the CFrame is clear.

---

I noticed that you went down the path where gui blocks are each represented by their own bitmap.

an important point for those reading this and who have already started to think about it:
should only work on one bitmap, with all gui elements rendered on it. Including the z-order.
In this case, there will be more possibilities for rendering. (shadows, gradients, etc.)
And control is simplified (we will not go to the level of MT objects)

IMHO, each individual application window (dialog) should have its own bitmap and object on the chart (don't even consider the case where multiple EAs or indicators will "rape" a single bitmap resource).
In this case, the shadow of a window may be implemented as an alpha-channel bitmap and thus remove the computational load of calculating this shadow.
All GUI elements of a single window are drawn on its bitmap considering Z order and nesting (I don't know how to call nesting of GUI objects correctly)

Monitor mouse events through CHARTEVENT_MOUSE_MOVE, I did it in my projects, no lags found.
Using other events without loss of mouse input quality was not possible.
 
For my MQL projects, I want to bring GUI library to WPF analogue, where markup and events are described in a text file (e.g. XML).

It only remains for me to implement the events that the GUI engine will call according to the description in the text file.
 
Zorro:
IMHO, each individual application window (dialog) should have its own bitmap and object on the chart (do not even consider the case where multiple EAs or indicators will "abuse" one bitmap resource).
In this case, the shadow of a window may be implemented as an alpha-channel bitmap and thus remove the computational load of calculating this shadow.
All GUI elements of a single window are drawn on its bitmap considering Z order and nesting (I do not know how to call nesting of GUI objects)

this is correct.

I would add that not just "every dialog", but specifically one bitmap per expert/indicator. More is possible, but this is at the coder's discretion.

I think that when you have a working dialog on the bitmap, then adding modal windows on the same bitmap or another dialog on the same bitmap is a technical matter and is not important right now.

First of all, we make an abstract model without specifics, e.g. which windows are located where, etc..

Then you will be able to cover all the different features and behaviours

 
o_O:

Greetings coders.

There's an interesting task to do something really useful, and I think crowdsourcing would be a good option.
First, the results will be available to everyone in the early stages. Second, we will make something new using MQL. And maybe we will even ask the MT developers for new goodies.

----

So here is the first and basic task.

1. We need to make a class of button (let's say GButton, prefixed with G not to confuse with existing ones).
- So far the button is simple with text (no extra pictures)
- the button is drawn on a certain area of the canvas
- the button has a click event.



---
In time we will make the codes on the bitbucket.

I am following it with interest and would like to interfere a bit: imho developer (like me) would invest in crowded GUI, if this GUI can be drawn not only by means of terminal. I will explain - nice GUI is good, it's a plus for sales...but as long as it doesn't eat away resources. It would be ideal to have a GUI library that can switch the back-end. For example while I'm not too anal about resources - let it be drawn by terminal on canvas (demos/market), but as soon as something serious - draw it via quick tools on bitmap. There are all sorts of cairo (not to mention OpenGL) which handle drawing easier.

The ideal GUI is designed in a separate application and imported as XML for example. It's not a good idea to describe the location of buttons and dialog forms in an EA.
 
Example, schematic:

Layout:
<sample>
   <window
     name='Sample'
     caption='Sample'
     x=0
     y=0
     width=320
     height=240
     OnClose='CloseApp'>

     <button caption='Exit' x y width height OnClick='ButtonExitClick'/>    

   </window>

</sample>
Implementation of events:
class SampleCloseAction : public CloseAction
  {
public:
               SampleCloseAction() { SetActionName("CloseApp"); }
   virtual int Execute() { Print('Bye'); return(0); }
  };

class ButtonExitAction : public ButtonClickAction
  {
public:
               ButtonExitAction() { SetActionName("ButtonExitClick"); }
   virtual int Execute() { GUI::WindowClose('Sample'); return(0); }
  };

BaseAction *actions[];

actions[0]=new SampleCloseAction;
actions[1]=new ButtonExitAction;

GUI::WindowCreate('Sample',actions);
 
Maxim Kuznetsov:

In general, it would be ideal to have a GUI that is designed in a separate application and imported as XML for example. It's not a good idea to write the layout of buttons and dialog forms in the Expert Advisor.

there )

you come to our first task, which we will do after creating the elements.

 
Maxim Kuznetsov:
In general, it would be ideal to have a GUI that is designed in a separate application and imported as XML for example. It's not a good idea to write button layouts and dialog forms in an EA.
In this case, first of all, you should write a fast and good XML parser. It is a good thing to have at home. I myself use one version of CodeBase, it is too slow for some tasks, especially for new builds. I've already got all these patches and crutches in it. In general, write a good parser comrades! Make it easy for everyone.
 
Vasiliy Sokolov:
In that case, you should start by writing a fast and good XML parser. It's quite a handy thing to have around the house. I'm using one version of CodeBase myself, but it's really slow on some tasks, especially in new builds. I've already got all these patches and crutches in it. In general, write a good parser comrades! Make it easy for everyone.
Maybe you know how to make a fully working and fully drawn slider? In general terms at least... I'd like to grasp the general concept.
 
Реter Konow:
Maybe you know how to make a working and fully drawn slider? In general terms at least... I'd like to learn the general concept.
Unfortunately, I can't. It's a rather complicated element even if you create it on the basis of normal primitives.
 
Реter Konow:
Maybe you know how to make a fully working and fully drawn slider? In general terms at least... I'd like to learn the general concept.

look into CCanvas class. all rendering primitives are available.

secondly, you can load bmp for your empties and shuffle them a la BitBlt onto the canvas.

Reason: