PureCOLOR library : coloring gadgets (and much more)

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Pantcho!! wrote:What about transparent Background Color?
an important factor to such a great special library!! (great for stringgadget's)
You mean StringGadget backcolor = window background color ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

Ok maybe i didnt explain myself so good, lets say i setup a windowbackground IMAGE doesnt matter which color i will use in textgadget it will do a box around the window image background.

in short:
i have a window background image
set the textgadget background color transparent so only the foreground color will show with my nice window background.

if this is possible this lib is perfect.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Pantcho!! wrote:set the textgadget background color transparent so only the foreground color will show with my nice window background.
if this is possible this lib is perfect.
Transparent is not possible I think, but it is possible to set the textgadget background color accordingly to the image color (so it looks transparent).
Maybe for the next version.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

gnozal wrote:Maybe for the next version.
:P :lol:
oldBear
Enthusiast
Enthusiast
Posts: 121
Joined: Tue Jul 05, 2005 2:42 pm
Location: berrypatch

Post by oldBear »

Wow - I'm new to purebasic and had noticed in the documentation that font colors were not supported.

This routine is fantastic :P

Many thanks for the support. I hope this is indicative of user base support. If so, I'll be a happy camper.

cheers
oldBear
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

oldBear wrote:This routine is fantastic :P
Many thanks for the support. I hope this is indicative of user base support. If so, I'll be a happy camper.
Thank you 8)
And wellcome to Purebasic !
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

Question: When I change the color of the window, the background color
of text gadgets, frame labels, and string gadgets (at least) does not change.

You can see this by running a slightly modifed version of your example:

Code: Select all

;
;             PureCOLOR library test file 1
;
; --------------------------------------------------------
;
; Set CallBack
Procedure.l WindowCallBack(WindowID.l, Message.l, wParam.l, lParam.l) 
  ReturnValue.l = #PB_ProcessPureBasicEvents
  ;
  ReturnValue = PureCOLOR_CallBack(WindowID, Message, wParam, lParam, ReturnValue) ; <-------- add this line in your window callback
  ;
  ProcedureReturn ReturnValue 
EndProcedure
; Create Window
OpenWindow(0, 100, 300, 400, 200, #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 | #PB_ListIcon_FullRowSelect)
  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, 30, "TextGadget 3", #PB_Text_Center)
  DisableGadget(3,#TRUE)
  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
PureCOLOR_SetWindowColor(0, RGB(249, 248, 158)) 

PureCOLOR_SetGadgetColor(1, RGB(255,0,0), -1)
;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_SetGadgetColorEx(2, RGB(255,0,0), RGB(0,255,0), 0, #PureCOLOR_LTV_SelectedItem)
;PureCOLOR_ClearGadgetColor(2)
;
Repeat 
Until WaitWindowEvent() = #PB_EventCloseWindow 
;
End
and looking at the TextGadget(3)

Is there a way using PureCOLOR to make the background default to
transparent instead of grey?

Thanks
Terry
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

TerryHough wrote:Is there a way using PureCOLOR to make the background default to transparent instead of grey? Thanks Terry
In the current version, no.
However, in the current beta, if you specify BackColor = #PureCOLOR_DontSetBackColor, the gadget back color is the current window color, so it simulates transparency.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Library update

Whats new :
- PureCOLOR_SetGadgetColor : if BackColor = #PureCOLOR_DontSetBackColor, BackColor is the parent window color (simulates transparency)
- PureCOLOR_SetGadgetColorEx : new flag #PureCOLOR_BackgroundImage : gadget's backcolor is image color (simulates transparency)

Special Terry version ;-)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

Thanks for the update.

It even works with Frame3DGadget() better than I had been able to
accomplish, a bonus.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Library update

What's new :
- new function : PureCOLOR_SetPopupMenuBackColor()
- new function : PureCOLOR_ClearAllColorsForGadget()
- new function : PureCOLOR_RedrawGadgetAfterColor()
- new feature : column headers now also use dynamic coordinates
- new feature : PureCOLOR_SetButtonColor() has extra colors (when button is pushed) and #PB_Button_Toggle support

Code: Select all

; Create Window 
OpenWindow(0, 100, 300, 310, 40, #PB_Window_ScreenCentered | #PB_Window_SystemMenu, "PureCOLOR button test") 
If CreateGadgetList(WindowID()) 
  ButtonGadget(3, 10, 10, 80, 20, "Normal") 
  ButtonGadget(4, 210, 10, 80, 20, "Extra + Toggle", #PB_Button_Toggle) 
  ButtonGadget(6, 110, 10, 80, 20, "Extra Colors") 
EndIf 
; Adding colors 
PureCOLOR_SetButtonColor(3, RGB(255,0,255), RGB(0,255,255)) 
PureCOLOR_SetButtonColor(4, RGB(255,0,0), RGB(0,255,0), RGB(255,127,0), RGB(255,255,0)) 
;PureCOLOR_SetButtonColor(6, RGB(255,0,0), RGB(0,255,0), RGB(255,127,0), RGB(255,255,0)) 
PureCOLOR_SetButtonColor(6, RGB(255,0,0), #PureCOLOR_SystemColor, RGB(255,0,0), #PureCOLOR_SystemColor) 
; 
Repeat 
Until WaitWindowEvent() = #PB_EventCloseWindow 
End
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Will you be adding colouring to menus?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

DoubleDutch wrote:Will you be adding colouring to menus?
PureCOLOR_SetPopupMenuBackColor() may also work for menu (I didn't test it). If not, I will fix it.
If you mean full color support (menu textcolor, etc...), probably not ; but who knows ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

I mean menu text colour, if you want i can try to provide some code to do it if it helps?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

DoubleDutch wrote:I mean menu text colour, if you want i can try to provide some code to do it if it helps?
You mean owner draw menus ?
They don't seem to work very well under Win9x or WinNT4, and I don't have Win2k/XP (yet ?). Of course, if you have some code that works with older OS, I could use it.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply