PureCOLOR library : coloring gadgets (and much more)

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

Moderator: gnozal

Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Hello Gnozal, thanks for the quick reply... Sorry i haven't read the manual, i was used to the old coloring system. Thank you very much for the help!
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
oridan
Enthusiast
Enthusiast
Posts: 128
Joined: Tue Oct 12, 2004 12:14 am
Location: Italy
Contact:

Post by oridan »

With the PUREColor Lib, the MenuBar() is considered as a MenuItem().
This is bug?
A solution to my problem?

Image with Lib and without Lib
ImageImage
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

oridan wrote:With the PUREColor Lib, the MenuBar() is considered as a MenuItem().
This is bug?
Yes
oridan wrote:A solution to my problem?
Can't think of any right now, sorry.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
oridan
Enthusiast
Enthusiast
Posts: 128
Joined: Tue Oct 12, 2004 12:14 am
Location: Italy
Contact:

Post by oridan »

gnozal wrote:Can't think of any right now, sorry.
OK, I will wait! Thank you.
kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Post by kinglestat »

I'm trying to use PureCOLOR to set transparent background to checkboxgadget and panelgadget. I tried both with #PureCOLOR_DontSetBackColor and as well with PureCOLOR_SetGadgetColorEx ( gadget, #Black, #PureCOLOR_DontSetBackColor, ImageId, #PureCOLOR_BackgroundImage )

With Ex my app crashes

Any ideas ?
cheers

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

Post by gnozal »

kinglestat wrote:I'm trying to use PureCOLOR to set transparent background to checkboxgadget and panelgadget.
Here is an example with a transparent checkbox :

Code: Select all

;{- Enumerations / DataSections
;{ Windows
Enumeration
  #Window_0
EndEnumeration
;}
;{ Gadgets
Enumeration
  #Window_0_CheckBox_0
EndEnumeration
;}
;}
Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 439, 196, 400, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    If CreateGadgetList(WindowID(#Window_0))
      CheckBoxGadget(#Window_0_CheckBox_0, 88, 161, 238, 49, "Gadget_0")
      ; Gadget Colors
      PureCOLOR_SetGadgetColor(#Window_0_CheckBox_0, #PureCOLOR_SystemColor, #PureCOLOR_DontSetBackColor)
      ; Window Backcolor
      PureCOLOR_SetWindowColor(#Window_0, $FF)
    EndIf
  EndIf
EndProcedure

OpenWindow_Window_0()

;{- Event loop
Repeat
  Event = WaitWindowEvent()
  Select Event
    ; ///////////////////
    Case #PB_Event_Gadget
      EventGadget = EventGadget()
      EventType = EventType()
      If EventGadget = #Window_0_CheckBox_0
      EndIf
    ; //////////////////////
    Case #PB_Event_CloseWindow
      EventWindow = EventWindow()
      If EventWindow = #Window_0
        CloseWindow(#Window_0)
        Break
      EndIf
  EndSelect
Forever
;
;}
Note that this feature should only be used with gadgets using the #WM_CTLCOLORSTATIC message like Text/Option/Checkbox.
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

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.

But when running the source (HUGE PROJECT)

I used your PureCOLOR_SetGadgetColorEx() Command with the
#PureCOLOR_LV_AlternateColors2 Flag.

It ran the code and it did'nt work.
Ran the examples code and it worked.

so i started to play and then i realized
when you update the ListIconGadget the whole setting is going back to default.

So i had to force the PureCOLOR_SetGadgetColorEx() each time i update the list.

Is this suppose to be like that in the recent versions?
Because before i was just needed to assign this command to my ListIcon and thats it.

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: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.
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 never used that flag.

Even when i add a new item (a new row) to the gadget

boom the colors returns to default.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Pantcho!! wrote:I never used that flag.
Even when i add a new item (a new row) to the gadget
boom the colors returns to default.
!?
Do you have some code example ?
Look at the code below (PB3.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, #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar, "Window_0")
    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 = EventGadgetID()
      EventType = EventType()
      If EventGadget = #ListIcon_0_Gadget0
      EndIf
      ; //////////////////////
    Case #PB_Event_CloseWindow
      EventWindow = EventWindowID()
      If EventWindow = #Window_0
        CloseWindow(#Window_0)
        Break
      EndIf
  EndSelect
ForEver
;
;}
The color is only cleared if you use ClearGadgetItemList(), not if you use AddGadgetColumn() or AddGadgetItem().
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!! »

Thanks for you help, you code works fine.

I think i have somthing in my old code that causes it to go back to default
Maybe somthing in my callbacks or maybe because i use Paul purevision gadgets libs also in that project... (as i said its old)

Never mind, just wanted to clear this thing.

Problem in my side.

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

Post by kinglestat »

Hi gnozal

I figured out the problem
If I turn off "XP Skin support", it comes out transparent

Is there an incompatibility with XP skins ?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

kinglestat wrote:Hi gnozal

I figured out the problem
If I turn off "XP Skin support", it comes out transparent

Is there an incompatibility with XP skins ?
Probably
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Post by kinglestat »

hmmmmmm
fair enough
Is there or can somebody provide an example using the PureCOLOR_SetGadgetColorEx function with #PureCOLOR_BackgroundImage as I only managed to crash with trying it out

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

Post by gnozal »

kinglestat wrote:Is there or can somebody provide an example using the PureCOLOR_SetGadgetColorEx function with #PureCOLOR_BackgroundImage as I only managed to crash with trying it out
Did you try PureCOLOR_TEST_10.pb in your \Examples\PureCOLOR directory ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply