Posted: Mon Jul 03, 2006 1:53 pm
That did it, I was using -1 as backcolor but now, using #PureCOLOR_DontSetBackColor the results are exactly how I wanted. Thank you
!

http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
;-
;- Object: PureCOLOR Library for PureBasic 4.0
;- Author: Written by Gnozal
;- Link: http://people.freenet.de/gnozal/
;-
;- Patch v0.1 by flype, July 2006.
;-
#PureCOLOR_Ignore = #PB_Ignore
Enumeration 1 ; #PB_Gadget_xxxColor
#PB_Gadget_FrontColor
#PB_Gadget_BackColor
#PB_Gadget_LineColor
#PB_Gadget_TitleFrontColor
#PB_Gadget_TitleBackColor
#PB_Gadget_GrayTextColor
#PB_Gadget_TextPushedColor ; PureCOLOR_SetButtonColor()
#PB_Gadget_BackPushedColor ; PureCOLOR_SetButtonColor()
EndEnumeration
Procedure.l SetGadgetColorA(gadget.l, type.l, color.l) ; Workaround to avoid unlimited recursive call to the macro SetGadgetColor()
SetGadgetColor(gadget, type, color)
EndProcedure
Procedure.l SetGadgetColorB(gadget.l, type.l, color.l) ; Extends the possibilities of SetGadgetColor()
Select GadgetType(gadget)
Case #PB_GadgetType_Button
; Not supported by PureBasic. Time to use PureCOLOR.
Select type
Case #PB_Gadget_BackColor
PureCOLOR_SetButtonColor(gadget, #PureCOLOR_Ignore, color)
Case #PB_Gadget_FrontColor
PureCOLOR_SetButtonColor(gadget, color, #PureCOLOR_Ignore)
Case #PB_Gadget_TextPushedColor
PureCOLOR_SetButtonColor(gadget, #PureCOLOR_Ignore, #PureCOLOR_Ignore, color)
Case #PB_Gadget_BackPushedColor
PureCOLOR_SetButtonColor(gadget, #PureCOLOR_Ignore, #PureCOLOR_Ignore, #PureCOLOR_Ignore, color)
EndSelect
Case #PB_GadgetType_Panel
; Not supported by PureBasic. Time to use PureCOLOR.
Select type
Case #PB_Gadget_BackColor
PureCOLOR_SetGadgetColor(gadget, #PureCOLOR_Ignore, color)
Case #PB_Gadget_FrontColor
PureCOLOR_SetGadgetColor(gadget, color, #PureCOLOR_Ignore)
EndSelect
Case #PB_GadgetType_IPAddress
; Not supported. Neither PureBasic, Nor PureCOLOR.
Default
; Supported by PureBasic. No need to use PureCOLOR.
SetGadgetColorA(gadget, type, color)
EndSelect
EndProcedure
Macro SetGadgetColor(gadget, type, color) ; Patch PureBasic Built-In command.
SetGadgetColorB(gadget, type, color)
EndMacro
;- EOF
Code: Select all
;XIncludeFile "PureCOLOR_PATCH.pb"
If OpenWindow(0, 0, 0, 320, 240, "SetGadgetColor()", #PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
PanelGadget(0, 10, 10, 300, 220)
SetGadgetColor(0, #PB_Gadget_BackColor, $A0F0F0)
AddGadgetItem (0, -1, "Page 1")
ButtonGadget(1, 5, 5, 150, 40, "Exit")
;SetGadgetColor(1, #PB_Gadget_TextPushedColor, #Green)
;SetGadgetColor(1, #PB_Gadget_BackPushedColor, #Blue)
SetGadgetColor(1, #PB_Gadget_FrontColor, #Red)
SetGadgetColor(1, #PB_Gadget_BackColor, #Yellow)
EndIf
Repeat
Until WaitWindowEvent() = #PB_Event_Gadget
EndIf
Code: Select all
Procedure ColorCallBack(GadgetNumber.l, CellRow.l, CellColumn.l, *TextColor.LONG, *BackColor.LONG, *FontID.LONG)
Select GadgetNumber
Case #Fehlerstatistik_LGadget1
CellText.s=GetGadgetItemText(GadgetNumber,CellRow,1)
Select LCase(CellText)
Case "in produktion"
Col=#Orange
Case "ok"
Col=#Gruen
Case "gesperrt"
Col=#Rot
Case "ausschuss"
Col=#Purpur
Case "nacharbeit"
Col=#Mint
Default
Col=#Sys1
EndSelect
If Col<>#Gruen
*BackColor\l=Background_Edit(Col)
EndIf
Case #Ausschuss_LGadget1
CellText.s=GetGadgetItemText(GadgetNumber,CellRow,5)
If LCase(CellText)="nicht zugeordnet"
*BackColor\l=Background_Edit(#Rot)
EndIf
Case #Qualitaetsmanagement_LGadget1
Select CellColumn
Case 0 To 4
CellText.s=GetGadgetItemText(GadgetNumber,CellRow,4)
Select LCase(CellText)
Case "in produktion"
Col=#Orange
Case "ok"
Col=#Gruen
Case "gesperrt"
Col=#Rot
Case "ausschuss"
Col=#Purpur
Case "nacharbeit"
Col=#Mint
Default
Col=#Sys1
EndSelect
*BackColor\l=Background_Edit(Col)
Case 5 To 10
CellText.s=GetGadgetItemText(GadgetNumber,CellRow,CellColumn)
Select LCase(CellText)
Case ""
Col1=#Orange
Case "ok"
Col1=#Gruen
Case "gesperrt"
Col1=#Rot
Case "ausschuss"
Col1=#Purpur
Case "nacharbeit"
Col1=#Mint
EndSelect
*BackColor\l=Background_Edit(Col1)
EndSelect
Case #WDLGadget1
Select CellColumn
Case 0,1,2,3,4,15,16
CellText.s=GetGadgetItemText(GadgetNumber,CellRow,16)
Select LCase(CellText)
Case "in produktion"
Col=#Orange
Case "ok"
Col=#Gruen
Case "gesperrt"
Col=#Rot
Case "ausschuss"
Col=#Purpur
Case "nacharbeit"
Col=#Mint
Default
Col=#Sys1
EndSelect
If Col<Gruen>5
*BackColor\l=Background_Edit(#Rot)
EndIf
Case 7,9,11,13,14
Value=Val(GetGadgetItemText(GadgetNumber,CellRow,CellColumn))
If Value>500
*BackColor\l=Background_Edit(#Rot)
EndIf
EndSelect
Case #IDNut_LGadget_IDNut
;*FontID\l=FontID2 ; Workaround for Bug in PureColor Library 16.7.2006 19:33
CellText.s=GetGadgetItemText(GadgetNumber,CellRow,2)
Select LCase(CellText)
Case "in produktion"
Col=#Orange
Case "ok"
Col=#Gruen
Case "gesperrt"
Col=#Rot
Case "ausschuss"
Col=#Purpur
Case "nacharbeit"
Col=#Mint
Default
Col=#Sys1
EndSelect
*BackColor\l=Background_Edit(Col)
EndSelect
EndProcedure
Code: Select all
If IsGadget(GadgetNumber)
*FontID\l=GetGadgetFont(GadgetNumber)
EndIf
Ok, for the next version.magicjo wrote:@gnozal,
I would ask you if is possible change colors (front & back) of then combogadget's edit control too ( i've tried with the last version of your library (v12.20)) .
I've used the message #WM_CTLCOLOREDIT to do it for now , but i think is useful and logic if you'll add in you SUPER library!
Thanks in advance.