Hi ChrisR! Thanks for the update! I appreciate your help. Hope you're not taking offense to all these issues - I just want your code to be rock-solid so it can be dropped into any app and work flawlessly. <Wink>. Only three small issues left at the moment.
Issue 1
I can confirm the latest code works better with my window now except for one bit: the background color of an editable ComboBox is still white instead of dark, like in the screenshot and test code below.
My test code:
Code: Select all
XIncludeFile "ObjectColor.pbi"
Enumeration Window
  #Window_1
  #Window_2
EndEnumeration
Enumeration Gadgets
  #Combo
  #ListIcon
  #Editor
  #Splitter
EndEnumeration
If OpenWindow(#Window_1, 200, 200, 320, 60, "Window 1", #PB_Window_SystemMenu)
  button = ButtonGadget(#PB_Any, 10, 20, 300, 25, "Click to open second window")
EndIf
If OpenWindow(#Window_2, 600, 200, 320, 260, "Window 2", #PB_Window_SystemMenu | #PB_Window_Invisible)
  ComboBoxGadget(#Combo, 10, 10, 300, 28, #PB_ComboBox_Editable | #CBS_HASSTRINGS | #CBS_OWNERDRAWFIXED)
  For I = 1 To 5 : AddGadgetItem(#Combo, -1,"ComboBox Element " + Str(I)) : Next
  SetGadgetState(#Combo, 1)
  
  ListIconGadget(#ListIcon, 0, 0, 0, 0, "ListIcon Column 1", 180)
  AddGadgetColumn(#ListIcon, 1, "Column 2", 120)
  For I = 1 To 5 : AddGadgetItem(#ListIcon, -1,"Column 1 Element " + Str(I) +Chr(10)+ "Column 2 Element " + Str(I)) : Next
  EditorGadget(#Editor, 0, 0, 0, 0)
  For I = 0 To 5 : AddGadgetItem(#Editor, I, "Editor Line " + Str(I)) : Next 
  
  SplitterGadget(#Splitter, 10, 50, 300, 200, #ListIcon, #Editor, #PB_Splitter_Separator)
  SetGadgetState(#Splitter, 110)
EndIf
SetDarkTheme()
SetObjectColor(#PB_All, #PB_All, RGB(50,50,50))
Repeat
  ev = WaitWindowEvent()
  If ev = #PB_Event_Gadget And EventGadget() = button
    HideWindow(#Window_2, #False)
  EndIf
Until ev = #PB_Event_CloseWindow
 
Issue 2
I have another window that gets opened on demand by the app (after selecting a menu item on the main window to open it), and only its background color goes dark. Its TextGadget and ListIcon don't go dark at all. See the below screenshot of its top-right corner (for privacy) and the code I'm using to open it and make it dark (not compilable, but surely it shows if I'm doing something wrong?).
Code: Select all
win=OpenWindow(#PB_Any,0,0,w,h,"Window",#PB_Window_Invisible|#PB_Window_SystemMenu|#PB_Window_WindowCentered,app) ; app = Main app window.
If win
  txt=TextGadget(#PB_Any,6,5,w-(15),20,"text text",#PB_Text_Center)
  lig=ListIconGadget(#PB_Any,0,29,w,h-(29),n$,w-sw,#LVS_NOCOLUMNHEADER|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_MultiSelect|#PB_ListIcon_GridLines)
  AddGadgetColumn(lig,1,"Header",0)
  For i=1 To ws
    AddGadgetItem(lig,-1,w$(i))
  Next
  SetObjectColor(win,#PB_All,colordarkmode) ; Doesn't make TXT or LIG gadgets go dark.
  SetActiveGadget(lig)
  HideWindow(win,0)
  Repeat
    ev=WaitWindowEvent()
    ...
 
Issue 3
When my main app's window is hidden (HideWindow) and then shown, or unminimized from a minimized state, the ListIcon backgrounds show white briefly before changing back to dark. A noticeable flash. Any tips on how to stop that? Thanks.