Modified one of your examples to exhibit what I am trying to do.
Code: Select all
; Set Callback
Procedure.l WindowCallBack(WindowId.l, Message.l, wParam.l, lParam.l)
ReturnValue = #PB_ProcessPureBasicEvents
;
ReturnValue = PureCOLOR_CallBack(WindowId, Message, wParam, lParam, ReturnValue)
;
ProcedureReturn ReturnValue
EndProcedure
; Create Window
OpenWindow(0, 100, 300, 400, 400, #PB_Window_ScreenCentered|#PB_Window_SystemMenu, "PureCOLOR test")
SetWindowCallback(@WindowCallBack())
If CreateGadgetList(WindowID())
StringGadget(1, 10, 10, 90, 20, "StringGadget 1")
ListIconGadget(2, 10, 40, 150, 100, "", 146, #PB_ListIcon_GridLines)
AddGadgetItem(2, -1, "ListIconGadget 2-1")
AddGadgetItem(2, -1, "ListIconGadget 2-2")
AddGadgetItem(2, -1, "ListIconGadget 2-3")
AddGadgetItem(2, -1, "ListIconGadget 2-4")
AddGadgetItem(2, -1, "ListIconGadget 2-5")
TextGadget(3, 10, 160, 300, 200, "TextGadget 3")
ButtonGadget(4, 200, 10, 80, 20, "Button 4")
ComboBoxGadget(5, 295, 10, 100, 100)
AddGadgetItem(5, -1, "ComboBox 5-1")
AddGadgetItem(5, -1, "ComboBox 5-2")
SetGadgetState(5, 0)
CheckBoxGadget(6, 110, 10, 80, 20, "CheckBox 6")
ListViewGadget(7, 160, 40, 150, 100, #PB_ListIcon_GridLines)
AddGadgetItem(7, -1, "ListViewGadget 7-1")
AddGadgetItem(7, -1, "ListViewGadget 7-2")
AddGadgetItem(7, -1, "ListViewGadget 7-3")
EndIf
; Adding colors
Msg$ = "The StringGadget gets the text changed to Red, system Default background "
Msg$ + "But after a 10 second delay, let's change its background color without changing "
Msg$ + "its text color. However, lets assume we don't know its current text color. We "
Msg$ + "want to change the background without knowing or affecting the text color. "
PureCOLOR_SetGadgetColor(1, RGB(255,0,0), -1)
SetGadgetText(3,Msg$)
; -----------------------------------------------------------------------------------
; PureCOLOR_SetGadgetColor(2, RGB(0,255,0), -1)
; PureCOLOR_SetGadgetColorEx(2, RGB(0,0,0), RGB(255, 255, 255), RGB(255, 255, 223), #PureCOLOR_LV_AlternateColors)
; PureCOLOR_SetGadgetColor(3, RGB(255,0,0), RGB(0,0,0))
; PureCOLOR_SetButtonColor(4, RGB(255,0,0), RGB(0,255,0))
; PureCOLOR_SetGadgetColor(5, RGB(255,0,0), RGB(255,255,0))
; PureCOLOR_SetGadgetColor(6, RGB(255,255,0), -1)
; PureCOLOR_SetGadgetColor(7, RGB(255,0,0), RGB(100,100,0))
; PureCOLOR_ClearGadgetColor(2)
;
Msg$ = "OK. let's wait 10 seconds so we can see how it looks to begin with."
Msg$ + "and then change the StringGadget's background color only."
SetGadgetText(3,Msg$)
While WindowEvent(): Wend
Delay(10000)
PureCOLOR_SetGadgetColor(1, -1, RGB(150,150, 255))
Msg$ = "Nope, that didn't work. The text was changed to black (System default). "
Msg$ + " So, lets set it back to the original and try again."
SetGadgetText(3,Msg$)
While WindowEvent(): Wend
Delay(10000)
PureCOLOR_SetGadgetColor(1, RGB(255,0,0), -1)
While WindowEvent(): Wend
Delay(1000)
PureCOLOR_SetGadgetColor(1, 0, RGB(150,150, 255))
While WindowEvent(): Wend
Msg$ = "Nope, that didn't work. The text was changed to black (System default) again. "
Msg$ + "So, lets set it back to the original and try again. This time lets see if we can "
Msg$ + "find out its current color and just reset to that."
SetGadgetText(3,Msg$)
PureCOLOR_SetGadgetColor(1, RGB(255,0,0), -1)
While WindowEvent(): Wend
Delay(1000)
ActivateGadget(1)
TextColor = GetSysColor_(#COLOR_WINDOWTEXT)
PureCOLOR_SetGadgetColor(1, TextColor, RGB(150,150, 255))
Msg$ = "Nope, that didn't work. The text was changed to black (System default) again. "
Msg$ + "But, obviously, I don't know how to use the WinAPI to get the current text color."
SetGadgetText(3,Msg$)
While WindowEvent(): Wend
Repeat
Until WaitWindowEvent() = #PB_EventCloseWindow
End
text color alone, no matter what the current color is.
use it. Is it possible to have another value that leaves the existing color
as is when the PureCOLOR_SetGadgetColor() command is executed.