SetGadgetColor: #PB_Default

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

SetGadgetColor: #PB_Default

Post by IdeasVacuum »

Would be good to use #PB_Default with SetGadgetColor as we can with SetGadgetFont.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Regenduft
Enthusiast
Enthusiast
Posts: 121
Joined: Mon Mar 02, 2009 9:20 pm
Location: Germany

Re: SetGadgetColor: #PB_Default

Post by Regenduft »

Try before you sigh! ;)

Code: Select all

If OpenWindow(0, 0, 0, 200, 170, "SetGadgetColor", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  StringGadget(0, 10, 10, 180, 20, "String...")
  ListViewGadget(1, 10, 40, 180, 60)
  For i = 0 To 4
    AddGadgetItem(1, -1, "Text")
  Next i
  ContainerGadget(2, 10, 110, 180, 50, #PB_Container_Raised)

  SetGadgetColor(0, #PB_Gadget_BackColor, $00FFFF)
  SetGadgetColor(1, #PB_Gadget_FrontColor, $FFFFFF)
  SetGadgetColor(1, #PB_Gadget_BackColor, $000000)
  SetGadgetColor(2, #PB_Gadget_BackColor, $0000FF)

  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  
  SetGadgetColor(0, #PB_Gadget_BackColor, #PB_Default)
  SetGadgetColor(1, #PB_Gadget_FrontColor, #PB_Default)
  SetGadgetColor(1, #PB_Gadget_BackColor, #PB_Default)
  SetGadgetColor(2, #PB_Gadget_BackColor, #PB_Default)
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  
EndIf
PB-Help (SetGadgetColor) wrote:To remove the custom color and go back to the default system color, set the 'Color' parameter to -1.

Code: Select all

Debug #PB_Default ; output = -1
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: SetGadgetColor: #PB_Default

Post by IdeasVacuum »

...erm no, not to return to or set System Default Colour but to set a PB Default Colour and use that colour for all gadgets following - i.e. in a similar way to 2D drawing.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Regenduft
Enthusiast
Enthusiast
Posts: 121
Joined: Mon Mar 02, 2009 9:20 pm
Location: Germany

Re: SetGadgetColor: #PB_Default

Post by Regenduft »

I see, you mean using #PB_Default for the #Gadget parameter! Sorry, I got that wrong! Yes... that would be nice... :)
Post Reply