PureCOLOR library : coloring gadgets (and much more)
Moderator: gnozal
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact:
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Shhhhh... Little pigs have big ears! 
Edit: May 31st - Its out now!!!

Edit: May 31st - Its out now!!!
Last edited by DoubleDutch on Fri Jun 01, 2007 9:42 am, edited 1 time in total.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Seems to work here.dige wrote:Using PureColorLib for PB4.10
and
PureCOLOR_SetGadgetColor(GadgetID, $A00000, $E0E0E0)
results a PoLink Error:
PB 4.10 Compiler Options:
[x] ThreadSafe
[x] OnError Support
[x] XP-Skin
Did you enabled the 'UserLibThreadSafe' subsystem ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Are you using jaPBe or PB IDE ?dige wrote:I guess not ... 've just enabled the [x] Threadsafe checkbox ...
jaPBe should automatically restart the compiler to enable the 'UserLibThreadSafe' subsystem if you compile a threadsafe executable (you get a 'PB4 Flags : /UserLibThreadSafe' message in the log).
With PB IDE, you have to enable it manually I guess.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
PureCOLOR help :dige wrote:Yes! With jaPBe it works fine.
But how to use a SubSystem with PB-IDE?
Seems not mentioned in the help docs ...
In PB IDE, add "UserLibThreadSafe" to the 'Library subsystem :' stringadget in 'Compiler options' and it should work.This library exists in several versions :
- the standard version, located in %Purebasic%\PureLibraries\UserLibraries\ ;
- the thread-safe version, located in %Purebasic%\SubSystems\UserLibThreadSafe\PureLibraries\ .
- the unicode version, located in %Purebasic%\SubSystems\UserLibUnicode\PureLibraries\ .
- the unicode + thread-safe version, located in %Purebasic%\SubSystems\UserLibunicodeThreadSafe\PureLibraries\ .
In order to use this library in thread-safe mode (compiler option /THREAD), you have to enable the
subsystem 'UserLibThreadSafe' in the PB IDE, or add '/SUBSYSTEM UserLibThreadSafe' to the
PBCompiler arguments. In jaPBe, do nothing : it will automatically enable the 'UserLibThreadSafe'
subsystem to use the threadsafe versions of the installed userlibraries.
It's the same logic for unicode and unicode + thread-safe modes.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
@Gnozal
Remember my little problem with #PureCOLOR_LV_AlternateColors?
Well here is a simple code to show you what happens
PB4 code (the same happens with pb 3.94)
Thanks.
Remember my little problem with #PureCOLOR_LV_AlternateColors?
Well here is a simple code to show you what happens
PB4 code (the same happens with pb 3.94)
Code: Select all
;{- Enumerations / DataSections
;{ Windows
Enumeration
#Window_0
EndEnumeration
;}
;{ Gadgets
Enumeration
#ListIcon_0_Gadget0
EndEnumeration
;}
;}
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 450, 200, 400, 400, "okok" , #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If CreateGadgetList(WindowID(#Window_0))
ListIconGadget(#ListIcon_0_Gadget0, 11, 5, 382, 382, "Gadget_0", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
AddGadgetItem(#ListIcon_0_Gadget0, -1, "line 1")
AddGadgetItem(#ListIcon_0_Gadget0, -1, "line 2")
AddGadgetItem(#ListIcon_0_Gadget0, -1, "line 3")
AddGadgetItem(#ListIcon_0_Gadget0, -1, "line 4")
SendMessage_(GadgetID(#ListIcon_0_Gadget0), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER)
; Gadget Colors
PureCOLOR_SetGadgetColorEx(#ListIcon_0_Gadget0, #PureCOLOR_SystemColor, $8000, $80FF, #PureCOLOR_LV_AlternateColors)
EndIf
EndIf
EndProcedure
OpenWindow_Window_0()
;ClearGadgetItemList(#ListIcon_0_Gadget0) ; color is cleared
AddGadgetColumn(#ListIcon_0_Gadget0, 1, "New column", 100) ; color is not cleared
AddGadgetItem(#ListIcon_0_Gadget0, -1, "line 5") ; color is not cleared
;{- Event loop
Repeat
Event = WaitWindowEvent()
Select Event
; ///////////////////
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #ListIcon_0_Gadget0
MessageRequester("","check this out")
ClearGadgetItemList(#ListIcon_0_Gadget0)
For x = 1 To 10
AddGadgetItem(#ListIcon_0_Gadget0,-1,"line " + Str(x))
Next
MessageRequester("","Colors are gone")
EndIf
; //////////////////////
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
ForEver
;
;}
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Sure.Pantcho!! wrote:@Gnozal
Remember my little problem with #PureCOLOR_LV_AlternateColors?
Well here is a simple code to show you what happens
I also remember my answer

Explanation : ClearGadgetItemList() sends a #LVM_DELETEALLITEMS messagegnozal wrote:If the listicon receives the #LVM_DELETEALLITEMS message, the gadget colors are cleared.Pantcho!! wrote:I have loaded a PB 3.94 source code and i don't remember if i updated my PureColor Lib but as i checked it seems i have the latest.
when you update the ListIconGadget the whole setting is going back to default.
Workaround : define the colors again after ClearGadgetItemList().
Code: Select all
;{- Enumerations / DataSections
;{ Windows
Enumeration
#Window_0
EndEnumeration
;}
;{ Gadgets
Enumeration
#ListIcon_0_Gadget0
EndEnumeration
;}
;}
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 450, 200, 400, 400, "okok" , #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If CreateGadgetList(WindowID(#Window_0))
ListIconGadget(#ListIcon_0_Gadget0, 11, 5, 382, 382, "Gadget_0", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
AddGadgetItem(#ListIcon_0_Gadget0, -1, "line 1")
AddGadgetItem(#ListIcon_0_Gadget0, -1, "line 2")
AddGadgetItem(#ListIcon_0_Gadget0, -1, "line 3")
AddGadgetItem(#ListIcon_0_Gadget0, -1, "line 4")
SendMessage_(GadgetID(#ListIcon_0_Gadget0), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER)
; Gadget Colors
PureCOLOR_SetGadgetColorEx(#ListIcon_0_Gadget0, #PureCOLOR_SystemColor, $8000, $80FF, #PureCOLOR_LV_AlternateColors)
EndIf
EndIf
EndProcedure
OpenWindow_Window_0()
;ClearGadgetItemList(#ListIcon_0_Gadget0) ; color is cleared
AddGadgetColumn(#ListIcon_0_Gadget0, 1, "New column", 100) ; color is not cleared
AddGadgetItem(#ListIcon_0_Gadget0, -1, "line 5") ; color is not cleared
;{- Event loop
Repeat
Event = WaitWindowEvent()
Select Event
; ///////////////////
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #ListIcon_0_Gadget0
MessageRequester("","check this out")
ClearGadgetItemList(#ListIcon_0_Gadget0)
; gnozal
PureCOLOR_SetGadgetColorEx(#ListIcon_0_Gadget0, #PureCOLOR_SystemColor, $8000, $80FF, #PureCOLOR_LV_AlternateColors)
;
For x = 1 To 10
AddGadgetItem(#ListIcon_0_Gadget0,-1,"line " + Str(x))
Next
MessageRequester("","Colors are not gone")
EndIf
; //////////////////////
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
ForEver
;
;}
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
You just have to add one little line ...Pantcho!! wrote:Any chance to add Alternate3 and Alternate4 to make it when you clear the list it wont happen?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
I understand that but just to make it clear,
this was not the case in earlier versions of purecolor right?
cuz all my projects i use these flags just happen to get the colors cleared
and i have many procedures that updates the list and clearing it (i am talking about projects with 3 - 6 include files).
so adding this line after each clear will be a huge work to do but if there is no choice
again thanks for your great libs!
this was not the case in earlier versions of purecolor right?
cuz all my projects i use these flags just happen to get the colors cleared
and i have many procedures that updates the list and clearing it (i am talking about projects with 3 - 6 include files).
so adding this line after each clear will be a huge work to do but if there is no choice

again thanks for your great libs!