From 50cf207eaee0a7362657c192806b28eda51915bf Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 30 Jun 2024 11:05:16 +1200 Subject: [PATCH] gui: fix properties tab background colour for windows build --- main.go | 5 ++--- util_vcl.go | 13 +++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 3aacee6..a9dff1f 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,6 @@ import ( "github.com/pkg/browser" "github.com/ying32/govcl/vcl" "github.com/ying32/govcl/vcl/types" - "github.com/ying32/govcl/vcl/types/colors" ) const ( @@ -187,8 +186,8 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) { f.propertiesBox.BorderSpacing().SetAround(MY_SPACING) f.propertiesBox.SetAlign(types.AlClient) // fill remaining space f.propertiesBox.SetReadOnly(true) - f.propertiesBox.SetEnabled(true) // Need to leave it enabled so scrolling works - f.propertiesBox.SetColor(colors.ClForm) // 0x00f0f0f0 + f.propertiesBox.SetEnabled(true) // Need to leave it enabled so scrolling works + f.propertiesBox.SetColor(vcl_default_tab_background()) f.propertiesBox.SetBorderStyle(types.BsNone) f.propertiesBox.SetScrollBars(types.SsAutoVertical) diff --git a/util_vcl.go b/util_vcl.go index bc82efa..4b94005 100644 --- a/util_vcl.go +++ b/util_vcl.go @@ -1,8 +1,11 @@ package main import ( + "runtime" + "github.com/ying32/govcl/vcl" "github.com/ying32/govcl/vcl/types" + "github.com/ying32/govcl/vcl/types/colors" ) const ( @@ -49,3 +52,13 @@ func vcl_menuseparator(parent *vcl.TMenuItem) *vcl.TMenuItem { 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 + } +}