Gallery of UIs written in MQL - page 37

 
Реter Konow #:

1. V-box(es) and tabs are always written in separate groups. This is more convenient. It is desirable not to add anything else to these groups. Otherwise, the"positioning jungle" begins. Of course, you can do it this way, but it's not worth it...

Retag Konow #:
A very important nuance. The tabs control the switching of the V_BOX(a) canvas images. They must be declared above. Tabs first, then the V_BOX (s).

I haven't figured out how to work with tabs yet. I have drawn H_TAB, but they are just buttons, and I don't know how to switch tabs using them. I'd like an example with two tabs. Or is it too early for that?

Retag Konow #:

3. You put the word "TEXT" in the tables. This is unnecessary. CELL cells have their own parameter that gets a value from the user application when connected. Or, use the word V_CURRENT to set the value.

It is CELL that is needed, the cells will be filled programmatically. So far I have set fixed values.

And V_CURRENT helped, the rubbish is gone.

Retag Konow #:
Another important nuance. All tables have a T_HEADER element in their header

Yes, in the first table it is appropriate because it creates a column for row names.

In the second table this column is not needed, so I didn't add it. But it worked out well.

The second table is a future event log. Perhaps the table is a bad option for this? If programmatically it would be difficult to add rows.

 
Edgar Akhmadeev #:

on H_TAB, "Report", until I added the icon, there was some ghost of an icon distorting the title. It disappeared after clicking on it.

I don't know if it's a bug, but the described TEXT_ALIGN_*s are missing.

This has not been answered yet.

And I wanted to apply I_BUTTON instead of TB_BUTTON, but there you need to know how to align the icon and text, by default they overlap.

 
Edgar Akhmadeev #:

I haven't figured out how to work with tabs yet. I've drawn H_TAB, but they are just buttons, but I don't know how to switch tabs using them. I'd like an example with two tabs. Or is it too early for that?

CELL is exactly what I need, the cells will be filled programmatically. So far I have set fixed values.

And V_CURRENT helped, the rubbish disappeared.

Yes, in the first table it is appropriate because it creates a column for row names.

In the second table this column is not needed, so I didn't add it. But it worked well.

The second table is a future event log. Perhaps the table is a bad option for this? If programmatically it would be difficult to add rows.

Take an example from the Labels Menu window in "Include\(1) KIB 1.0\(1) BASE\ (2) STATE KIB-CODE" . It declares a group of tabs and a V_BOX. It is only one for three tabs. Each tab has its own group of icons. You can use this as a template. Only there are tabs at the top, not at the bottom. Try to put them at the bottom. I think it'll work.


//===================================================================================================================
 GROUP, "Main tabs",

__, H_TAB, "16x16",ON,   H_TAB, "24x24",  H_TAB, "32x32", GAP,150, EDIT, "E1", W, 320, _,READ_ONLY,  

END_GROUP,
//----------------------------
i, AT, _X2X, "MF", 2, _Y2Y, "MF",2,

i, SWITCH,"16x16","24x24","32x32",END,
i, TENURED,
i, H_TABS, AH_COLOR, (int)C'255,255,255', A_COLOR, (int)C'255,255,255', N_COLOR, (int)C'250,250,250',
 
 P_COLOR,(int)C'236,244,252',  NPG_LINES,20, NPG_STEP,1, NG_LINES,20, NG_STEP,1, END,

"16x16",     IS_APPEARANCE_CONTROLLER,  "LABELS 16*16",END,
"24x24",     IS_APPEARANCE_CONTROLLER,  "LABELS 24*24", END,
"32x32",     IS_APPEARANCE_CONTROLLER,  "LABELS 32*32", END,
//----------------------------------------------------------------------------------
"LABELS 16*16","24x24","32x32", 
//===================================================================================================================

//===================================================================================================================
//----------------------------------------------------------------------------------
GROUP,"Labels v_box 16*16",

__,   V_BOX,"V1", W,800, _,H,330,_,N_FRAME,1,_,A_FRAME,1,_,NP_FRAME,1, AP_FRAME,1,

END_GROUP,
//----------------------------
i, AT, _X2X, "16x16", 0, _Y2H, "16x16", -1,/**/
//===================================================================================================================
 
Edgar Akhmadeev #:

This has not yet been answered.

And instead of TB_BUTTON I wanted to apply I_BUTTON, but there you need to know how to align the icon and text, by default they overlap.

I need to think about it. I have forgotten a lot of things. I'll look for a solution and let you know.

 
Edgar Akhmadeev #:

This has not yet been answered.

And instead of TB_BUTTON I wanted to apply I_BUTTON, but there you need to know how to align the icon and text, by default they overlap.

Try to use the same approach as with C_HEADER:

i, C_HEADERS, 
        TEXT_STYLE, (int)FW_BOLD, 
        FONT_SIZE, 10, 
        text, _A1_, _X2X, 
        text, _C1_, 20, 
        text, N_COLOR, (int)C'86,86,86', 
        NG_LINES, 30, NG_STEP, -1,
        POINTED, 0, 
        N_COLOR, (int)C'219,233,249', A_COLOR, (int)C'155,244,196', AH_COLOR, (int)C'155,244,196', 
        END,

For example:

i, I_BUTTONS,  text, _A1_, _X2X,  text, _C1_, 30,    label, _A1_, _X2X,  label, _C1_, 5,     W, 120, H,30,    END,
 
Реter Konow #:
i, I_BUTTONS, text, _A1_, _X2X, text, _C1_, 30, label, _A1_, _X2X, label, _C1_, 5, W, 120, H,30, END,


Working line.

 

The second variant of positioning the icon and text on the elements:

i, I_BUTTONS,  
     //-------------- 
    text, _A1_, _C2C, // Привязка текста к центру кнопки по оси Х  (_C2C - center to center). 
    text, _C1_,    0// Поправка позиции относительно центра кнопки по оси Х (0). 
     //-------------- 
    text, _A2_, _C2C,  // Привязка текста к центру кнопки по оси Y  (_C2C - - center to center). 
    text, _C2_,   10// Поправка позиции текста относительно центра кнопки по оси Y  (10). 
     //-------------- 
    label, _A2_, _Y2Y, // Привязка иконки к верху кнопки по оси Y  (_Y2Y  - Y to Y). 
    label, _C2_,   5// Поправка позиции иконки относительно Y координаты кнопки по оси Y  (5). 
     //-------------- 
    W, 100 , H, 50 , 
     //-------------- 
    END,
   //------------------------------------------------------ 
   "Button 1" , N_LABEL, "::Images\\16x16\\Lock.bmp" ,
   //------------------------------------------------------


text, _A1_, _C2C, // Bind the text to the centre of the button along the X axis (_C2C - centre to centre).

text, _C1_, 0, // Correction of position relative to the centre of the button along the X axis (0).

//--------------

text, _A2_, _C2C, // Bind the text to the centre of the button along the Y axis (_C2C - - centre to centre).

text, _C2_, 10, // Correction of the text position relative to the centre of the button along the Y axis (10).

//--------------

label, _A2_, _Y2Y, // Snap the icon to the top of the button along the Y axis (_Y2Y - Y to Y Coordinate).

label, _C2_, 5, // Correction of the icon position relative to the Y coordinate of the button along the Y axis (5).




 

Essentially there are only two options for positioning the text and icon inside the buttons. Both are shown above.

You can use it as a template for any elements with text and icon. Just change the element name, icons, texts and corrections (_C1, _C2).

Technically you can make other variants of text and icon arrangement inside elements, but practically they don't make sense. If the need arises, you can consider them.

In general, the template is ready. Try it out.

 
Edgar Akhmadeev #:

This has not yet been answered.

...

Did my answer help?
 
We are a little ahead of ourselves, but after the update we will return to the previous training programme. But already with the possibility of connecting advisors. There's not much left.