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 »

DoubleDutch wrote:This code should demonstrate the drawing...
Oh yes, with drawing you can do everything ... I am using it for the buttons, but I hate it :D (feels not 'clean' to me) ...

Here are some (working) examples :
viewtopic.php?t=14334&start=0&postdays= ... r+selected
viewtopic.php?t=13226&start=0&postdays= ... r+selected

I will see if I can do it for the next version.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

1.) The coloring of string gadget does not work for me if string gadget is borderless and read-only.

2.) The alternating coloring of cells/rows does not work over here.

This is using the newest PB/Win, XP Pro (themes disabled).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Shannara wrote:1.) The coloring of string gadget does not work for me if string gadget is borderless and read-only.

2.) The alternating coloring of cells/rows does not work over here.

This is using the newest PB/Win, XP Pro (themes disabled).
Any code please ?
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
- new feature : added ProgressBarGadget and EditorGadget support for PureCOLOR_SetGadgetColor()

Code: Select all

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
Enumeration
  #Window
  #Gadget
  #Edit
EndEnumeration
If OpenWindow(#Window, 200, 200, 300, 200, #PB_Window_SystemMenu  | #PB_Window_TitleBar , "ProgressBar & RichEdit")
  If CreateGadgetList(WindowID())
    ProgressBarGadget(#Gadget, 50, 10, 190, 20, 0, 100 ,#PB_ProgressBar_Smooth)
    PureCOLOR_SetGadgetColor(#Gadget, RGB(51, 100, 153), RGB(255, 204, 51))
    SetGadgetState(#Gadget, 50)
    EditorGadget(#Edit, 10, 40, 280, 140)
    SetGadgetText(#Edit, "This is text!")
    PureCOLOR_SetGadgetColor(#Edit, RGB(255, 255, 255), RGB(255, 0, 255))
  EndIf
  Repeat
    Event  = WaitWindowEvent()
  Until Event  = #PB_EventCloseWindow
EndIf
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 »

nice :D
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

just a little bug ( or missing feature ) :

the function PureCOLOR_SetGadgetColorEx(#Gadget,$000000,$FFFFFF,0,#PureCOLOR_LTV_SelectedItem) doesn't work when applied on a ListIconGadget() created with the flag #PB_ListIcon_AlwaysShowSelection.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Post by Le Soldat Inconnu »

an other bug, the textgadget is not colored if it's in a panelgadget

just text this :

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, 250, #PB_Window_SystemMenu, "PureCOLOR test") 
SetWindowCallback(@WindowCallBack()) 
If CreateGadgetList(WindowID()) 
  PanelGadget(10, 0, 0, 400, 250)
  AddGadgetItem(10, 0, "Test")
  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)
  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")
  CloseGadgetList()
EndIf
; Adding colors
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
LSI
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

soldat inconnu:
this one works for me with the lastest PureCOLOR.zip :roll:
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Flype wrote:soldat inconnu:
this one works for me with the lastest PureCOLOR.zip :roll:
It works for me too :roll:
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 »

Flype wrote:just a little bug ( or missing feature ) : the function PureCOLOR_SetGadgetColorEx(#Gadget,$000000,$FFFFFF,0,#PureCOLOR_LTV_SelectedItem) doesn't work when applied on a ListIconGadget() created with the flag #PB_ListIcon_AlwaysShowSelection.
You are right :( I haven't tested this one.
Fixed (almost :wink:) : the selected item is now colored but the selection is not shown if the gadget has not the focus (uItemState is not #CDIS_SELECTED / #CDIS_FOCUS).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Phant0m``

Post by Phant0m`` »

Code: Select all

AppColors.s="RGB(128,0,0).$000000.$F1FCE3.$000000"

PureCOLOR_SetGadgetColor(#Gadget,$000000,StringField(AppColors,3,"."))
I’m stumped to why the use of StringField(AppColors,3,".") is giving PureCOLOR problems using correct hex colors.

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

Post by gnozal »

Phant0m`` wrote:

Code: Select all

AppColors.s="RGB(128,0,0).$000000.$F1FCE3.$000000"

PureCOLOR_SetGadgetColor(#Gadget,$000000,StringField(AppColors,3,"."))
I’m stumped to why the use of StringField(AppColors,3,".") is giving PureCOLOR problems using correct hex colors.
:?
It is not a bug.
PureCOLOR _SetGadgetColor() expects a LONG, not a STRING, and StringField() returns a string ...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Phant0m``

Post by Phant0m`` »

I tried everything all yesterday to change it to LONG, but it all messy up on me, so it is impossible to extract from a variable and use as a LONG?
Phant0m``

Post by Phant0m`` »

I came up with a workaround, little bit of additional code involved, but she works all the same. :lol:
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

:shock: :shock: :shock: :shock: :shock:

What about transparent Background Color?

an important factor to such a great special library!!

(great for stringgadget's)
Post Reply