Discussion of article "Graphical Interfaces X: Text selection in the Multiline Text box (build 13)" - page 13

 
Anatoli Kazharski:

There are more methods for binding elements:

//---

In combination with these properties, try to solve the problem.


Yes, I tried it, but I have already broken my head, I understood that methods X(...) and Y(...) rigidly bind elements to X and Y coordinates and when receiving events on changing the size of the main form window, they do not react in any way to the location of X and Y coordinates.
 
Konstantin:

Yes, I've tried it, but I've already broken my head, I understood that methods X(...) and Y(...) rigidly bind elements to X and Y coordinates and when receiving events on changing the size of the main form window, they do not react in any way to the location of X and Y coordinates.

Can you show an analogue of what you need on the example of some ready-made Windows application? I'm not sure I understand what you need. Or depict it graphically somehow.

If I understood correctly, element_2 should be bound to the bottom edge of the form, and element_1 should be auto-resized vertically with an indentation to the height of element_2.

 
Anatoli Kazharski:

Can you show an analogue of what you need on the example of some ready-made Windows application? I'm not sure I understand what you need. Or depict it graphically somehow.

If I understood correctly, element_2 should be bound to the bottom edge of the form, and element_1 should be auto-resized vertically with an indentation to the height of element_2.


You got it right, i.e. when the window size changes, element_1 changes Y size, and you need element_2 to follow this reduction, i.e. normal scaling of elements inside the form. So far I have built a crutch that element_1 is not scaled )). I'll deal with this issue later.
 
the library lacks display priority setting, because icons from open orders/positions have higher priority and accordingly are placed on top of all graphical elements of the library, I think it can be realised when creating graphical objects in the "core" of the library.
 
Konstantin:
the library lacks display priorities, because icons from open orders/positions have a higher priority and accordingly are placed on top of all graphical elements of the library, I think it can be realised by creating graphical objects in the "core" of the library.

Try it like this:

Forum on trading, automated trading systems and testing trading strategies

Discussion of the article "GUI X: Text selection in a multi-line input field (build 13)".

Anatoli Kazharski, 2017.05.08 21:40

In the custom application class you need to create a CProgram::OnTradeEvent() method.

And in the main file it should be called in the OnTrade() function:

//+------------------------------------------------------------------+
//| Trade function|
//+------------------------------------------------------------------+
void OnTrade(void)
  {
   program.OnTradeEvent();
  }

//---

For example, I have this content of CProgram::OnTradeEvent() method:

//+------------------------------------------------------------------+
//| Trade transaction event|
//+------------------------------------------------------------------+
void CProgram::OnTradeEvent(void)
  {
//--- Sending a trade event to all charts
   m_events.SendEventToAllCharts(0,ON_TRADE_EVENT,0,0.0,m_program_name);
//--- Set the transactions of the last position
   if(m_show_deals.CheckButtonState())
      if(m_vdeals.ShowDealsLastPosition())
         ResetWindow();
//--- Checking the stop loss distance
   if(m_trailing_stop.CheckButtonState())
      m_ctrade.CheckStopLossSize(::Symbol());
//--- Zeroing of variables for trade operations
   m_ctrade.ZeroCalcPositionVariables();
//--- Initialisation of the balance array and updating of the series on the chart
   InitBalanceArray();
   m_line_chart.SeriesUpdate(0,m_balance_data,"Balance",clrCornflowerBlue);
  }

 
Anatoli Kazharski:

Try it like this:


I've seen this, but I think you need to supplement the usage in the "core" of the library, i.e. when creating graphical objects:

bool  ObjectSetInteger( 
   long                             chart_id,      // chart identifier 
   string                           name,          // name 
   ENUM_OBJECT_PROPERTY_INTEGER     prop_id,       // property 
   long                             prop_value     // value 
   );

property:

OBJPROP_BACK

 
Konstantin:

I've seen this, but I think that in the "core" of the library, i.e. when creating graphical objects, you need to supplement the usage:

property:

OBJPROP_BACK

Then the graphics will be over the graphical objects of the interface.

//---

Do ResetWindow() for now. I'll try to build it into the kernel later so that it will be automatically updated.

 
Anatoli Kazharski:

Then the graphs will be over the graphical objects of the interface.

//---

Do ResetWindow() for now. I'll try to build it into the kernel later so that it will be automatically updated.


not quite like that, you need to put all graphical objects in the foreground, then graphics will be behind, I have implemented this many times on my graphics library ))
 
Konstantin:

not exactly, you need to prioritise all graphical objects to the foreground, then the graphs will be behind, I have implemented this many times on my graphical library ))

I don't know what you did and how you did it, but by default they are in the foreground. The most recently created ones are on top. The only way to change the priority after creation is to hide and show the objects again, except for the ones that should be on the bottom.

 

In the method of class CTabs:

void CTabs::CalculatingPatch(int &x,int &y,int &x_size,int &y_size)
  {
   if(ArraySize(m_tabs) == 0)
      return;

   if(m_position_mode==TABS_TOP)
     {
      x      =m_tabs[m_selected_tab].X()+1;
      y      =m_tabs[m_selected_tab].Y2()-1;
      x_size =m_tabs[m_selected_tab].XSize()-2;
      y_size =1;
     }
   else if(m_position_mode==TABS_BOTTOM)
     {
      x      =m_tabs[m_selected_tab].X()+1;
      y      =m_tabs[m_selected_tab].Y();
      x_size =m_tabs[m_selected_tab].XSize()-2;
      y_size =1;
     }
   else if(m_position_mode==TABS_LEFT)
     {
      x      =m_tabs[m_selected_tab].X2()-1;
      y      =m_tabs[m_selected_tab].Y()+1;
      x_size =1;
      y_size =m_tabs[m_selected_tab].YSize()-2;
     }
   else if(m_position_mode==TABS_RIGHT)
     {
      x      =m_tabs[m_selected_tab].X();
      y      =m_tabs[m_selected_tab].Y()+1;
      x_size =1;
      y_size =m_tabs[m_selected_tab].YSize()-2;
     }
  }

should be added highlighted, it is a check for null array, because without this check in case of no tabs, the whole form crashes with an error.