🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by Kris Tue, 31 Jul 2007 17:44
My Unicode combobox has problems with its XP/Vista visual appearance
#1544
Author: Kris
Date: Tue, 31 Jul 2007 17:44
56 lines
2439 bytes
Hi,

Using the small piece of code below I create a combobox capable of 
displaying Unicode. Everything works just great except for a few details 
of the visual appearance of the box. Compared to a regular XP/Vista 
themed TComboBox I can see following differences:

+ XP/Vista: When opening the drop down list and moving over the 
available items no blue selection bar (which is as wide as the combobox) 
will follow the mouse cursor when moving over the items in the drop down 
list.
+ Vista: A combobox with its drop down list not active will show 
incorrect background colour.

TXPManifest is present on the form and does indeed takes care of most of 
the theming for the unicode combo, but a few details are missing when 
compared to a regular VCL TCombobox.

Any suggestions are much appreciated,

Kris

HWND hwndCB;
INITCOMMONCONTROLSEX icex;

icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_USEREX_CLASSES;

InitCommonControlsEx(&icex);

hwndCB=CreateWindowW(
			WC_COMBOBOXEXW,
			NULL,
			WS_BORDER | WS_VISIBLE |
			WS_CHILD | CBS_DROPDOWNLIST,
			80,
			80,
			0,
			100,
			Handle,
			NULL,
			Form1,
			NULL
		);
		
COMBOBOXEXITEMW ComboItemW;
memset(&ComboItemW,0,sizeof(ComboItemW));

ComboItemW.pszText=MyWideString;
ComboItemW.mask = CBEIF_TEXT;
ComboItemW.iItem=0;

SendMessage(hwndCB,CBEM_INSERTITEMW,-1,(LPARAM)&ComboItemW);
SendMessage(hwndCB,CBEM_INSERTITEMW,-1,(LPARAM)&ComboItemW);

SetWindowPos(hwndCB,NULL,80,80,250,120,SWP_NOACTIVATE);
Re: My Unicode combobox has problems with its XP/Vista visual appearance
#1545
Author: Kris
Date: Tue, 31 Jul 2007 21:52
24 lines
1908 bytes
Kris wrote:
> Hi,
> 
> Using the small piece of code below I create a combobox capable of 
> displaying Unicode. Everything works just great except for a few details 
> of the visual appearance of the box. 

While looking around I found the SETWINDOWTHEME message which sets the 
visual style of a ComboBoxEx control. This could potentially solve the 
theming problems I am experiencing.
http://msdn2.microsoft.com/en-us/library/ms673108.aspx

The code then would look something like this:

WideString VisualStyleSet="to be done";
SendMessage(hwndCB,CBEM_SETWINDOWTHEME,0,(LPARAM)(LPWSTR)VisualStyleSet);

However:
- CBEM_SETWINDOWTHEME is unknown (BDS2006). Even after including CommCtrl.h
- I haven't got a clue what the LPARAM should be. According to MSDN this 
parameter is 'A pointer to a Unicode string that contains the control 
visual style to set.' but I'm unable to determine its value.

Kris
Re: My Unicode combobox has problems with its XP/Vista visual appearance
#1546
Author: Bob Gonder
Date: Tue, 31 Jul 2007 23:12
18 lines
1459 bytes
Kris wrote:

>However:
>- CBEM_SETWINDOWTHEME is unknown (BDS2006). Even after including CommCtrl.h

It is in there....

#if (_WIN32_WINNT >= 0x501)
#define CCM_SETWINDOWTHEME      (CCM_FIRST + 0xb)

#if (_WIN32_WINNT >= 0x501)
#define CBEM_SETWINDOWTHEME     CCM_SETWINDOWTHEME
#endif

>- I haven't got a clue what the LPARAM should be. According to MSDN this 

Maybe this link will help?
http://msdn2.microsoft.com/en-us/library/Aa361669.aspx
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads