Achieving a higher contrast for the cell cursor in XbpQuickBrowse objects

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

Pat France

New member
Staff member
I am here to help you!
Aug 9, 2022
22
3
3
Customer Identifier
E114627
This post is only relevant for applications configured to use the default system theme in their UI elements. To do this, a manifest file or resource must be defined. See the example c:\users\<your-user>\documents\xbase++\samples\basics\manifest for further information. Applications not using such a manifest automatically use a compatible color scheme which does not exhibit the outlined contrast problems.

Background​


Newer Windows versions (Windows 10 and higher) tend to use a light color scheme which can make it hard to discern which UI element is currently active or has the input focus. In the case of XbpQuickBrowse objects, this may make it difficult for the user to tell which cell or line is currently selected in the browse, especially if non-standard colors are used. The following screenshot illustrates the problem.

1697188195004.png

Solution​

Disabling the usage of the system's default visual style for the browse can be an easy solution to get around this problem. Once the visual style is disabled, XbpQuickBrowse objects use a compatible color scheme for displaying cells and their backgrounds. This is usually enough for sufficiently increasing the contrast to make discerning the cell or row cursor easier for the user.

The following code snippet disables the usage of visual styles in a browse's data area:
Xbase++:
(...)
oBrowse:dataArea:useVisualStyle := .F.
oBrowse:create( ... )
(...)

This screenshot shows the same XbpQuickBrowse object as in the previous example, but with visual styles disabled:

1697189802975.png


Note that disabling visual styles allows the application to override the colors used when displaying cells. If the (compatible) highlight color defined in the system settings needs to be changed further, this can be achieved with the following code:

Xbase++:
(...)
oBrowse:dataArea:setPresParam( {{XBP_PP_HILITE_BGCLR, GRA_CLR_RED}} )
oBrowse:create( ... )
(...)
 
Last edited by a moderator: