![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
New article MQL5 Cookbook: Indicator Subwindow Controls - Scrollbar has been published at mql5.com:
Let's continue exploring various controls and this time turn our attention to scrollbar. Just like in the previous article entitled "MQL5 Cookbook: Indicator Subwindow Controls - Buttons", all operations will be performed in the indicator subwindow. Take a moment to read the above mentioned article as it provides a detailed description of working with events in the OnChartEvent() function, while this point will only be casually touched upon in this article. For illustrative purposes, this time around we will create a vertical scrollbar for a large list of all financial instrument properties that can be obtained using MQL5 resources.
In the previous articles on MQL5 programming we used the graphical object OBJ_LABEL (Text Label) to create lists. In this article, we will use a canvas to display text. The convenience of such approach lies in that instead of a great number of OBJ_LABEL objects, we will only use one - OBJ_BITMAP_LABEL (Bitmap Label). You can draw any interface elements on a canvas but this time we will limit ourselves to text only.
The scrollbar will be very simple. It usually has arrow buttons but they will not be features in our case. The scrollbar will only consist of the background and scroll box. The scroll box will change its color when the cursor goes over it. When clicked, it will also change color suggesting to the user that the scroll box is now selected and can be dragged. In creating scrolling objects, we will use graphical objects of the OBJ_RECTANGLE_LABEL (Rectangle Label) type.
Author: Anatoli Kazharski