Discussing the article: "MQL5 Trading Tools (Part 37): Adding a Per-Object Property-Editing Ribbon to the Canvas Drawing Layer"
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: MQL5 Trading Tools (Part 37): Adding a Per-Object Property-Editing Ribbon to the Canvas Drawing Layer.
We add a descriptor-driven property stack and a floating ribbon that binds to the current selection on the drawing layer. The article covers the descriptor list for each tool, the engine get/set API with snapshot-and-restore live preview, and widget renderers for color, opacity, line width, line style, fonts, and level visibility. You get in-place, real-time editing of object appearance via a compact, draggable panel.
Every drawn object already carries its full visual state as fields on the object structure — line width, line style, fill color and opacity, text color, font size, the per-level ratio and visibility arrays, the channel band sigmas, the pitchfork tine colors, and so on. Until now, those fields were written once at placement, either from the tool defaults or from the per-tool memory, and never touched again. Exposing them for editing is not a rendering problem, since the draw routines already read these fields on every redraw; it is a user-interface problem of getting a value from a widget into the right field on the right object.
The naive approach would use a bespoke editing panel, hand-built for each of the forty-odd tools. That path leads to enormous duplication and a maintenance nightmare. Instead, we take a descriptor-driven design. Each tool registers a list of property descriptors that declare what it exposes: a fill-color property, a line-width property, and a level-list property. Each descriptor names a type, a label, a value range, and a string identifier. The ribbon reads that list and renders the appropriate widget for each entry. One generic pipeline then drives every tool. Adding a property to a tool becomes a one-line registration rather than a new panel.
This system has four parts. The descriptor layer defines which properties a tool exposes. The widget layer defines how each property is rendered and edited. The engine get/set layer maps a descriptor ID to an object field. Finally, snapshot-and-restore enables live preview: slider changes apply immediately, and canceling restores the snapshot taken when the ribbon opens. With that conceptual map in place, we can move on to the implementation, but first, have a look at the visualized conceptual map below.
Author: Allan Munene Mutiiria