The PicWindow control (Only Visual Project Type)


Easy Code versions 2.02.0.0034 and later add the new PicWindow control (see images below), a little window, based on the "Picture" control, that can be placed inside the main window of the application and it has a caption and a close button to hide it. Since the PicWindow is not really closed when the close button is clicked (it is just hidden), you should call the DestroyWindow API function if you want to close it permanently. On the other hand, if the PicWindow should be shown or hidden according to the user's wishes, you should provide a menu option to show it again after it has been hidden. In order to show it (or hide it), although you can use the ShowWindow API function, it is better to use the SetVisible Easy Code method.

The PicWindow control can be aligned right, left, top or bottom inside the window in which it is placed on and it only contains a "Picture" control that is created at the same time as the PicWindow. This "Picture" control is the one that gives the background color to the PicWindow and where all needed controls should be dropped. The "Picture" will always occupy the whole client area of the PicWindow and it cannot be renamed, nor moved, nor resized, nor aligned, nor hidden, since the PicWindow itself takes care that the "Picture" always occupies the entire client area.

For you to have the control of the PicWindow, some messages will be sent to its window procedure. Clicking the mouse left-button on the PicWindow title bar (the caption) will send the WM_LBUTTONDOWN message and releasing the button will send the WM_LBUTTONUP message. On the other hand, if the mouse left-button is clicked on the close button, the message ECM_PICWINDOWCLOSEBTNDOWN will be sent. Then, if mouse left-button is released when the pointer is over the close button, the message ECM_PICWINDOWCLOSEBTNUP will be sent, while if the pointer is not over the close button when the mouse left-button is released, the message WM_LBUTTONUP will be sent.

Remember that any message returning TRUE will no longer be processed, so you can control the PicWindow behavior. For example, if the ECM_PICWINDOWCLOSEBTNUP message returns TRUE, the PicWindow will not be hidden.

WARNING: If the DestroyWindow or ShowWindow API functions are called with the "Picture" handle instead of the PicWindow handle, the entire PicWindow will be afected, that is, DestroyWindow will destroy the entire PicWindow and ShowWindow will hide it (or show it). This is because the PicWindow control CANNOT work without its "Picture" child control.