Page 1 of 1

color trackbar trick.

Posted: Wed Jan 07, 2004 12:59 pm
by Bong-Mong
Please Let me know if it works :P
window is purple, trackbar should be purple too.
alot of questions for colour trackbar but no answers.

Code: Select all

;-----Colour Trackbar Example-----
;-----User BongMong----
;-----07/01/04----

Global  purple
purple=CreateSolidBrush_(RGB($67,$32,$98))

Enumeration
#Window_0 = 1
EndEnumeration

Enumeration
#Gadget_0
EndEnumeration

Procedure myCallback(WindowID, Message, wParam, lParam)
  Result = #PB_ProcessPureBasicEvents
  Select Message
  Case #WM_CTLCOLORSTATIC
    Select lparam
    Case GadgetID(#Gadget_0)
      SetBkMode_(wParam,#TRANSPARENT)
      SettextColor_(wParam, $FFFFFF)
      Result = purple
 EndSelect
  EndSelect
  ProcedureReturn Result
EndProcedure

hWnd = OpenWindow(1, 278, 107, 351, 261,  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar , "BongMong")
    If hWnd
  SetWinBackgroundColor(hWnd, RGB($67,$32,$98))
  SetForeGroundWindow_(hWnd)
  SetWindowCallback(@myCallback())

If CreateGadgetList(WindowID())
      TrackBarGadget(#Gadget_0, 20, 230, 130, 20, 0, 100)
      ResizeGadget(#Gadget_0, -1, -1, 130, 19)
       
      Repeat
  
  Event = WaitWindowEvent()
  
    If Event = #PB_EventGadget
    
    GadgetID = EventGadgetID()
    
  EndIf
  
Until Event = #PB_EventCloseWindow
EndIf
EndIf 
End

Posted: Wed Jan 07, 2004 1:35 pm
by LarsG
Well.. I got a window with purple background, and a trackbargadget...
Didn't go over your code (just ran it), so I don't know if that was what you wanted?!? If it was, then I guess it worked..

-Lars

Posted: Wed Jan 07, 2004 4:45 pm
by TronDoc
the window background as well as
the trackbar background is purple
(w98fe) --jb

Posted: Wed Jan 07, 2004 5:14 pm
by Hi-Toro
Where does SetWinBackgroundColor come from? I'm running 3.81 and the command isn't found (not in the docs either)...

Posted: Wed Jan 07, 2004 5:15 pm
by dige
Unknown function: SetWinBackgroundColor() ...
Which library do I have to install for it?

cya dige

Posted: Wed Jan 07, 2004 5:27 pm
by Bong-Mong
not sure, i searched lib on forum, downloaded a pack

Posted: Wed Jan 07, 2004 6:52 pm
by Paul
Or you could just use PureVision and have it do all the hard work for you :)
http://www.reelmediaproductions.com/purevision

Plus it comes with a number of Add-ons for extra "eye candy" for your apps !!

Posted: Wed Jan 07, 2004 7:12 pm
by Danilo
dige wrote:Unknown function: SetWinBackgroundColor() ...
Which library do I have to install for it?
SkinWin

Posted: Thu Jan 08, 2004 7:27 pm
by Blade
Isn't possible to have an utility that given a comand, returns the library containing it?
When anyone will be able to build his own libraries this problem will arise often...

Posted: Thu Jan 08, 2004 8:01 pm
by Proteus
Blade wrote:Isn't possible to have an utility that given a comand, returns the library containing it?
When anyone will be able to build his own libraries this problem will arise often...
Only if there is a way to keep it updated. If anyone can create libs, something like this will be very difficult to keep up to date.

Posted: Sat Jan 10, 2004 1:18 am
by Andre
Blade wrote:Isn't possible to have an utility that given a comand, returns the library containing it?
When anyone will be able to build his own libraries this problem will arise often...
Maybe this wish will become true on PureArea.net one day... :wink:

Posted: Fri Oct 05, 2007 9:06 pm
by Falko
I have nothing found setcolor() of trackbar, but here it's found
:D

Sorry, i have change this source withe coloring Gadget of trackbar :roll:

Code: Select all

;-----Colour Trackbar Example-----
;-----User BongMong----
;-----07/01/04----
;-----edit by Falko (PB4 beta 3)
;------05/10/07
Global purple=CreateSolidBrush_(RGB($67,$32,$98))
Global blue=CreateSolidBrush_(RGB(20, 20, 235))
Global yellow=CreateSolidBrush_(RGB(237, 244, 18))



Enumeration
#Window_0 = 1
EndEnumeration

Enumeration
#Gadget_0
#Gadget_1
#Gadget_2
EndEnumeration

Procedure myCallback(WindowID, Message, wParam, lParam)
  Result = #PB_ProcessPureBasicEvents
  Select Message
  Case #WM_CTLCOLORSTATIC
    Select lparam
    Case GadgetID(#Gadget_0)
      SetBkMode_(wParam,#TRANSPARENT)
      SetTextColor_(wParam, $FFFFFF)
      Result = purple
    Case GadgetID(#Gadget_1)
      SetBkMode_(wParam,#TRANSPARENT)
      SetTextColor_(wParam, $FFFFFF)
      Result = blue
      
    Case GadgetID(#Gadget_2)
      SetBkMode_(wParam,#TRANSPARENT)
      SetTextColor_(wParam, $FFFFFF)
      Result = yellow 
 EndSelect
  EndSelect
  ProcedureReturn Result
EndProcedure

hWnd = OpenWindow(1, 278, 107, 351, 261, "BongMong",  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar )
    If hWnd
  
  ;SetForegroundWindow_(hWnd)
  SetWindowCallback(@myCallback())
If CreateGadgetList(WindowID(#Window_0))
      TrackBarGadget(#Gadget_0, 0, 20, 130, 20, 0, 100)
      TrackBarGadget (#Gadget_1,10, 80, 230, 20, 0,100)
      TrackBarGadget (#Gadget_2,280, 20, 20,200, 0,100,#PB_TrackBar_Vertical)
      SetWinBackgroundColor(GadgetID(#Gadget_0), RGB($67,$32,$98))
      ResizeGadget(#Gadget_0, 0, 20, 130, 20)
      SetWinBackgroundColor(GadgetID(#Gadget_1), RGB(20, 20, 235))
      ResizeGadget(#Gadget_1, 10,80,230, 20)
      SetWinBackgroundColor(GadgetID(#Gadget_2), RGB(237, 244, 18))
      ResizeGadget(#Gadget_2,280, 20, 20,200)
       
      Repeat
 
  Event = WaitWindowEvent()
 
    If Event = #PB_Event_Gadget
   
    GadgetID = EventGadget()
   
  EndIf
 
Until Event = #PB_Event_CloseWindow
EndIf
EndIf
End
Regards Falko