Gallery of UIs written in MQL - page 31

 

Try it for yourself, here's the code:

GROUP, A,

__, BUTTON, "Hello World!", _,text, N_COLOR, (uint)clrBlue,

                            _,text, A_COLOR, (uint)clrRed,
                            
          /*(when the button under cursor in neutral state)*/                      
                            _,text, P_COLOR, (uint)clrLime,
       
          /*(when the button under cursor in activated state)*/                      
                           _,text, AP_COLOR, (uint)clrWhite,
                                                     
                            _,FIC,//FIXED IF CLICKED

END_GROUP,
 

The meaning of the prefixes before the word COLOR:

  • N_ abbreviation for the word NEUTRAL. It refers to the state of the element.
  • A_ is an abbreviation for the word ACTIVATED. Usually refers to the pressed state of the element.
  • P_ is an abbreviation of the word POINTED. It means that the element is under the cursor in a neutral state.
  • AP_ is short for ACTIVATED POINTED. It means that the element is under the cursor in the activated state.


There are other state prefixes, but they are used less often. You can find them in the help file.

 
Since I've started a thread about setting element text properties, I'll continue. The next properties that logically come to mind are text size, font and style. All of them are also easily set with short lines. Here are some examples in pictures.
 

Set the font size:

 

Now the font itself:


 

Style:


 

For convenience, look at styles, fonts and sizes in the font window of the constructor:


Here is an indicator of the appearance of the text after selecting a font, style, and size:


 

The font styles possible are:




 

Code:

GROUP, A,

__, BUTTON, "Hello World!", _,text, N_COLOR, (uint)clrBlue,

                            _,text, A_COLOR, (uint)clrRed,
                            
          /*(when the button under cursor in neutral state)*/                      
                            _,text, P_COLOR, (uint)clrLime,
       
          /*(when the button under cursor in activated state)*/                      
                           _,text, AP_COLOR, (uint)clrWhite,                          
                           
//-------------------------------------------------------     
                           
                             _,text,FONT_SIZE, 14,
                           
//-------------------------------------------------------  
                           
                             _,TEXT_FONT,"Courier New",
                           
//------------------------------------------------------- 
                           
                             _,TEXT_STYLE,(int)FONT_UNDERLINE,
                           
//------------------------------------------------------- 
                                                    
                            _,FIC,//FIXED IF CLICKED

END_GROUP,
//--------------------------
 

Propagate the buttons and set the general text properties: