vielleicht kennt Ihr bereits mein Modul ListIconGadgetEx, das mehrere Funktionen bietet, die SpiderBasic nativ nicht unterstützt.
https://github.com/spiderbytes/ListIconGadgetEx
Ich habe nun eine neue Prozedur namens RenderCell() hinzugefügt, die es ermöglicht, die Datenausgabe zu manipulieren. Auf diese Weise könnt Ihr das Aussehen Eurer Daten beeinflussen.
Beispiel:
Code: Alles auswählen
EnableExplicit
XIncludeFile "ListIconGadgetEx.sbi"
Enumeration
#Window
#ListIconGadget
EndEnumeration
Procedure.s RenderCell(Row, Col, Text.s, TD, ListIconGadget)
; We want to set the text color depending on the amount:
Protected TextColor.s
If Val(Text) > 0
; incomming -> that's good! :-)
TextColor = "green"
ElseIf Val(Text) < 0
; outgoing -> that's bad :-(
TextColor = "red"
ElseIf Val(Text) = 0
; 0 -> neutral
TextColor = "black"
EndIf
! $(v_td).css("color", v_textcolor)
! $(v_td).css("text-align", "right"); // the column is right-aligned
; Now we change the output text:
; Please keep in mind that this only affects the *output*
; and GetGadget(Item)Text() still returns the Amount (without the '€'-sign)
Text + " €"
! $(v_td).text(v_text);
EndProcedure
OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 250, 200, "RenderCell Demo 1", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(#ListIconGadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window), "Description", 100, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(#ListIconGadget, 1, "Amount", 100)
AddGadgetItem(#ListIconGadget, -1, "Salary" + #LF$ + "2000")
AddGadgetItem(#ListIconGadget, -1, "Food & Drinks" + #LF$ + "-500")
AddGadgetItem(#ListIconGadget, -1, "Car Petrol" + #LF$ + "-160")
AddGadgetItem(#ListIconGadget, -1, "Internet" + #LF$ + "-50")
ListIconGadgetEx::RenderCell(#ListIconGadget, 1, @RenderCell()) ; we want to render the Amount-Column
Grüße ... Peter