PureCOLOR library : coloring gadgets (and much more)

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

Moderator: gnozal

kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Post by kinglestat »

me dumb, you thanks

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

Post by gnozal »

Update

Extra version for PB4.10 : http://freenet-homepage.de/gnozal/PureCOLOR__.zip
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
GG
Enthusiast
Enthusiast
Posts: 266
Joined: Tue Jul 26, 2005 12:02 pm
Location: Lieusaint (77), France

Post by GG »

Is PB 4.10 out ?
Purebasic 6.12 64 bits - Windows 11 Pro 64 bits 23H2
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Shhhhh... Little pigs have big ears! ;)

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
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

Using PureColorLib for PB4.10

and

PureCOLOR_SetGadgetColor(GadgetID, $A00000, $E0E0E0)

results a PoLink Error:

Image

PB 4.10 Compiler Options:

[x] ThreadSafe
[x] OnError Support
[x] XP-Skin
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

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
Seems to work here.
Did you enabled the 'UserLibThreadSafe' subsystem ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

I guess not ... 've just enabled the [x] Threadsafe checkbox ... :?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

dige wrote:I guess not ... 've just enabled the [x] Threadsafe checkbox ... :?
Are you using jaPBe or PB IDE ?
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).
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

Yes! With jaPBe it works fine.

But how to use a SubSystem with PB-IDE?
Seems not mentioned in the help docs ...
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

dige wrote:Yes! With jaPBe it works fine.

But how to use a SubSystem with PB-IDE?
Seems not mentioned in the help docs ...
PureCOLOR help :
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.
In PB IDE, add "UserLibThreadSafe" to the 'Library subsystem :' stringadget in 'Compiler options' and it should work.
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

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
;
;}
Thanks.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Pantcho!! wrote:@Gnozal

Remember my little problem with #PureCOLOR_LV_AlternateColors?

Well here is a simple code to show you what happens
Sure.
I also remember my answer :wink: :
gnozal wrote:
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.
If the listicon receives the #LVM_DELETEALLITEMS message, the gadget colors are cleared.
Explanation : ClearGadgetItemList() sends a #LVM_DELETEALLITEMS message
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).
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

Any chance to add Alternate3 and Alternate4 to make it when you clear the list it wont happen?

Just if you can or want.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Pantcho!! wrote:Any chance to add Alternate3 and Alternate4 to make it when you clear the list it wont happen?
You just have to add one little line ...
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!! »

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!
Post Reply