Vertical caption alignment in XbpSLE objects

I Love Xbase++ (ILX)
The portal for Xbase++ developers worldwide

Till Warweg

Member
Staff member
I am here to help you!
Feb 1, 2021
35
7
8
Customer Identifier
E074775

Abstract​

The Windows edit control used in the XbpSLE class does not support controlling vertical aligment of the caption text. Instead, the caption is always displayed aligned to the top/left corner. This may look visually disruptive in window layouts containing single-line entry fields placed next to combo boxes, for example.

Overriding default behavior in a custom class​

The system's default behavior can be changed via the Win32 API by implementing a custom class derived from XbpSLE. A sample project for such an implementation is attached to this posting. The project demonstrates the following procedures:
  • Sub-classing the Windows edit control and using a DLL callback for custom Windows message processing
  • Using the WM_NCCALCSIZE Windows message for offsetting the edit control's client rectangle to vertically center the caption in the control
  • Using the WM_NCPAINT message for erasing/clearing the window area vacated by offsetting the client rectangle
 

Attachments

  • vertalignslesample.zip
    3.6 KB · Views: 101