[64] White back of read-only edits in packed files props

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

[64] White back of read-only edits in packed files props

Post by *MVV »

Win7x64, classic style theme.

TCx64 displays edit fields in packed file properties dialog with white background instead of usual dialog colour background.

Image
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This isn't a bug, that's how tabs should actually look! It was a bug that Delphi 2 couldn't show them like this in 32-bit. I couldn't find a way to make that work in 32-bit.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It looks just like a bug for classic themes, looks very unpleasant. Maybe you should explicitly set background colour of edit fields from tab page background one? :?:

BTW you may look onto my VirtualPanel's configuration dialog. It have themed tabs and background of read-only items is the same as tab background on both Aero and classic themes.

I don't think it is a bug in Delphi 2, it seems that it just doesn't support this. I was need to load additional API function to enable themes for tabs (I load it dynamically because it is Windows XP only function):

Code: Select all

HRESULT EnableThemeDialogTextureStub(HWND hWnd, DWORD dwFlags) {
	typedef HRESULT (WINAPI* HR__HW_DW)(HWND hWnd, DWORD dwFlags);

	HMODULE uxtheme=GetModuleHandleA("uxtheme.dll");
	HR__HW_DW EnableThemeDialogTexture=uxtheme ? (HR__HW_DW)GetProcAddress(uxtheme, "EnableThemeDialogTexture") : 0;
	return EnableThemeDialogTexture ? EnableThemeDialogTexture(hWnd, dwFlags) : S_FALSE;
}
All I need is to call this function once for dialog handle (on WM_INITDIALOG message) with second parameter ETDT_ENABLE and for every tab page handle with parameter ETDT_ENABLETAB.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Not fixed in Beta2.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

As I wrote, this behaviour is intentional. I will not change it.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Sad. :(
Read-only controls shouldn't have white background on grey dialog.
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

ghisler(Author) wrote:This isn't a bug, that's how tabs should actually look! It was a bug that Delphi 2 couldn't show them like this in 32-bit. I couldn't find a way to make that work in 32-bit.
Isn't this just some misunderstanding? I can indeed see wrong tab body background in 32-bit TC with Aero theme. 64-bit TC uses correct white color. And all those read-only edits also have correct white background.
But with Classic theme, tab body has grey (or some other user-selected color) background, but read-only edits are still white, which is not correct here. If you check other system dialogs, e.g. file properties, all read-only edits (with file name, size, etc...) have the same color as the main background.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Hmm, I didn't know that the page isn't white in classic theme, that makes it very complicated. :(

I will try to find out more.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Christian, as I wrote above, you should try to set same background color for edits as tab page has. This will work good for both themed and classic styles because in all styles read-only edits have same background as parent window has (grey color in classic style, and white one in themed style).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

What about other themes? The problem is that the text color in the edit controls needs to be readable too. In an extreme case, the tab background could be white, and the dialog background could be black.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

We can't guess which colors user will use. So we should follow Windows standards: read-only controls have same background color as their parent. Just open properties of any device in Device Manager - device state field have same background as tab page has in any theme.

BTW edits have property ParentColor - you may try to set it to True and Lazarus will fill them using same brush as tab page has (I think so).
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

MVV wrote:BTW edits have property ParentColor - you may try to set it to True and Lazarus will fill them using same brush as tab page has (I think so).
I tried it, but it doesn't work as expected. Themed tab control has main background color which is usual COLOR_3DFACE and different color for panel background. ParentColor takes the first one...

But in theory it should be easy:

if(ThemesEnabled)
PanelBgColor = GetThemeColor( right parameters ;) )
else
PanelBgColor = COLOR_3DFACE

After reading the docs, I'd say that among the right parameters should be TABP_PANE and TMT_FILLCOLOR, but unfortunately it doesn't seem to work for me at all. But I never worked with themes before, so it's probably the reason for that.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Interesting which colors use default API window procedure - after calling EnableThemeDialogTexture for tab page edits have correct color in all themes. :!:

Hm-m, maybe there is a way to set null brush or parent brush for edits via API?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed parent color doesn't work, that's why I'm struggling to find a solution working with and without themes...

I will try this EnableThemeDialogTexture with Lazarus. Of course that doesn't work without themes, but then the color is known.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This should be fixed in beta 3, please check! However, I couldn't find a solution when a theme created for XP was used on Windows Vista/7. The reported background color is wrong in this case.
Author of Total Commander
https://www.ghisler.com
Post Reply