Discussion of article "Improving Panels: Adding transparency, changing background color and inheriting from CAppDialog/CWndClient" - page 2

 

Vladimir, thanks for the articles, very useful material. I may have a lamer question...

There is an object of CBmpButton type - a button with an image. So, the button image itself acts as a resource here. How to get access to its properties? Or is it impossible?

An example from the Documentation.

There I played with the CControlsDialog::CreateBmpButton1() method:

//+------------------------------------------------------------------+
//| Create the "BmpButton1" button|
//+------------------------------------------------------------------+
bool CControlsDialog::CreateBmpButton1(void)
  {
//--- coordinates
   int x1 = INDENT_LEFT;
   int y1 = INDENT_TOP + (EDIT_HEIGHT + CONTROLS_GAP_Y);
   int x2 = x1 + BUTTON_WIDTH;
   int y2 = y1 + BUTTON_HEIGHT;
//--- create
   if(!m_bmpbutton1.Create(m_chart_id, m_name + "BmpButton1", m_subwin, x1, y1, x2, y2))
      return(false);
//--- sets the name of bmp files of the control CBmpButton
   string name1, name2;
   name1 = "\\Images\\euro.bmp";
   name2 = "\\Images\\dollar.bmp";
   m_bmpbutton1.BmpNames(name1, name2);
   if(!Add(m_bmpbutton1))
      return(false);
   m_chart.Redraw();
   if(ObjectFind(m_chart_id, name1) >= 0)
     {
      DebugBreak();
     }
//--- succeed
   return(true);
  }
//+------------------------------------------------------------------+

The object of the image itself on the panel is not found using ObjectFind(), which is quite natural. How to find it, if it is possible at all?

Thanks.

 
Denis Kirichenko:

Vladimir, thanks for the articles, very useful material. I may have a lamer question.....

There is an object of CBmpButton type - a button with an image. So, the button image itself acts as a resource here. How to get access to its properties? Or can't I?

Example from the Documentation.

There I played with CControlsDialog::CreateBmpButton1() method:

The object of the image itself on the panel is not found using ObjectFind(), which is quite natural. How to find it, if it is possible at all?

Thanks.

An image (drawing) is not an object. Objects are lines, rectangles ... graphic elements.

 

Hello, Vladimir. You have added an additional ClientArea to the window. And then you use CMyWndClient::ShiftButton method to scroll buttons. This is not very convenient, because there can be many buttons in the window. Also, there can be a lot of UI elements besides buttons. So, you see, writing methods for each element and not forgetting to call them in scrolling handlers is a challenge. Isn't it easier to scroll ClientArea? Then, all UI elements contained in it will be scrolled automatically. It is enough to specify only ClientArea scrolling in the handlers.

 
Mihail Matkovskij #:

Hello, Vladimir. You have added an additional ClientArea to the window. And then you use CMyWndClient::ShiftButton method to scroll buttons. This is not very convenient, because there can be many buttons in the window. Also, there can be a lot of UI elements besides buttons. So, you see, writing methods for each element and not forgetting to call them in scrolling handlers is a challenge. Isn't it easier to scroll ClientArea? Then, all UI elements contained in it will be scrolled automatically. It is enough to specify only ClientArea scrolling in the handlers.

Please write such an example. I think everyone will be interested in such an implementation.

 
Vladimir Karputov #:

Please write such an example. I think everyone will be interested in such an implementation.

After a bit of thinking, I figured it out. Such scrolling cannot be implemented because of the impossibility of partial hiding of any chart objects (in this case it is ClientArea and buttons). In other UIs it is implemented differently. They display a rectangular area that falls within the scrolling area, and everything else is hidden. Hence the confusion.

 
Perfect
 
Thanks, Vladimir, great work.
How could we achieve transparency for the header?