gui: fix properties tab background colour for windows build

This commit is contained in:
mappu 2024-06-30 11:05:16 +12:00
parent e5cbbb6822
commit 50cf207eae
2 changed files with 15 additions and 3 deletions

View File

@ -10,7 +10,6 @@ import (
"github.com/pkg/browser" "github.com/pkg/browser"
"github.com/ying32/govcl/vcl" "github.com/ying32/govcl/vcl"
"github.com/ying32/govcl/vcl/types" "github.com/ying32/govcl/vcl/types"
"github.com/ying32/govcl/vcl/types/colors"
) )
const ( const (
@ -187,8 +186,8 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
f.propertiesBox.BorderSpacing().SetAround(MY_SPACING) f.propertiesBox.BorderSpacing().SetAround(MY_SPACING)
f.propertiesBox.SetAlign(types.AlClient) // fill remaining space f.propertiesBox.SetAlign(types.AlClient) // fill remaining space
f.propertiesBox.SetReadOnly(true) f.propertiesBox.SetReadOnly(true)
f.propertiesBox.SetEnabled(true) // Need to leave it enabled so scrolling works f.propertiesBox.SetEnabled(true) // Need to leave it enabled so scrolling works
f.propertiesBox.SetColor(colors.ClForm) // 0x00f0f0f0 f.propertiesBox.SetColor(vcl_default_tab_background())
f.propertiesBox.SetBorderStyle(types.BsNone) f.propertiesBox.SetBorderStyle(types.BsNone)
f.propertiesBox.SetScrollBars(types.SsAutoVertical) f.propertiesBox.SetScrollBars(types.SsAutoVertical)

View File

@ -1,8 +1,11 @@
package main package main
import ( import (
"runtime"
"github.com/ying32/govcl/vcl" "github.com/ying32/govcl/vcl"
"github.com/ying32/govcl/vcl/types" "github.com/ying32/govcl/vcl/types"
"github.com/ying32/govcl/vcl/types/colors"
) )
const ( const (
@ -49,3 +52,13 @@ func vcl_menuseparator(parent *vcl.TMenuItem) *vcl.TMenuItem {
return s return s
} }
func vcl_default_tab_background() types.TColor {
if runtime.GOOS == "windows" {
// Assuming that uxtheme is loaded
// @ref https://stackoverflow.com/a/20332712
return colors.ClBtnHighlight
} else {
return colors.ClBtnFace // 0x00f0f0f0
}
}