Posted: Fri May 04, 2007 5:11 pm
me dumb, you thanks
cheers
cheers
http://www.purebasic.com
https://www.purebasic.fr/english/
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
Are you using jaPBe or PB IDE ?dige wrote:I guess not ... 've just enabled the [x] Threadsafe checkbox ...
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.
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
;
;}
Sure.Pantcho!! wrote:@Gnozal
Remember my little problem with #PureCOLOR_LV_AlternateColors?
Well here is a simple code to show you what happens
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.
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
;
;}
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?