color trackbar trick.

Share your advanced PureBasic knowledge/code with the community.
Bong-Mong
User
User
Posts: 35
Joined: Sat Jan 03, 2004 6:53 pm

color trackbar trick.

Post 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
Last edited by Bong-Mong on Wed Jan 07, 2004 1:46 pm, edited 1 time in total.
1.3AMD, 2x 256 sdr, 32 AGP
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post 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

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
TronDoc
Enthusiast
Enthusiast
Posts: 310
Joined: Wed Apr 30, 2003 3:50 am
Location: 3DoorsDown

Post by TronDoc »

the window background as well as
the trackbar background is purple
(w98fe) --jb
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]
Hi-Toro
Enthusiast
Enthusiast
Posts: 270
Joined: Sat Apr 26, 2003 3:23 pm

Post by Hi-Toro »

Where does SetWinBackgroundColor come from? I'm running 3.81 and the command isn't found (not in the docs either)...
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
dige
Addict
Addict
Posts: 1412
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

Unknown function: SetWinBackgroundColor() ...
Which library do I have to install for it?

cya dige
Bong-Mong
User
User
Posts: 35
Joined: Sat Jan 03, 2004 6:53 pm

Post by Bong-Mong »

not sure, i searched lib on forum, downloaded a pack
1.3AMD, 2x 256 sdr, 32 AGP
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1285
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post 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 !!
Image Image
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Post by Danilo »

dige wrote:Unknown function: SetWinBackgroundColor() ...
Which library do I have to install for it?
SkinWin
cya,
...Danilo
...:-=< http://codedan.net/work >=-:...
-= FaceBook.com/DaniloKrahn =-
Blade
Enthusiast
Enthusiast
Posts: 362
Joined: Wed Aug 06, 2003 2:49 pm
Location: Venice - Italy, Japan when possible.
Contact:

Post 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...
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post 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.
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2139
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Post 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:
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
Falko
Enthusiast
Enthusiast
Posts: 271
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

Post 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
www.falko-pure.de
Win11 Pro 64-Bit, PB_6.11b1
Post Reply