ListIconGadget - right align a column's content
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
ListIconGadget - right align a column's content
Is it possible to right align the contents of a particular column of a ListIconGadget?
Thanks
Thanks
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: ListIconGadget - right align a column's content
Bump.
I have the potential of a large project looming and this is going to be important for me.
I have the potential of a large project looming and this is going to be important for me.
Re: ListIconGadget - right align a column's content
Hi,
here are two procedures (SetColumnHeaderAlignment() and SetColumnAlignment()) that should solve your problem:
Greetings ... Peter
here are two procedures (SetColumnHeaderAlignment() and SetColumnAlignment()) that should solve your problem:
Code: Select all
Enumeration
#Window
#ListIconGadget
EndEnumeration
Procedure SetColumnHeaderAlignment(Column, Alignment.s)
! $("<style/>", {text: ".dgrid-cell.dgrid-column-" + v_column + "[role='columnheader'] {text-align: " + v_alignment + ";}"}).appendTo('head');
EndProcedure
Procedure SetColumnAlignment(Column, Alignment.s)
! $("<style/>", {text: ".dgrid-cell.dgrid-column-" + v_column + "[role='gridcell'] {text-align: " + v_alignment + ";}"}).appendTo('head');
EndProcedure
OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 800, 400, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(#ListIconGadget, 0, 0, 800, 400, "Column 0", 300, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(#ListIconGadget, 1, "Column 1", 400)
SetColumnHeaderAlignment(0, "center")
SetColumnAlignment(0, "right")
SetColumnHeaderAlignment(1, "right")
SetColumnAlignment(1, "center")
Define Counter
For Counter = 0 To 9
AddGadgetItem(#ListIconGadget, -1, "Column 0 / Row " + Counter + #LF$ + "Column 1 / Row " + Counter)
Next
Greetings ... Peter
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: ListIconGadget - right align a column's content
Thank you very much, Peter
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: ListIconGadget - right align a column's content
Peter, may I ask where you found the reference documents that enable you to figure this out? I'd really like to see what enhancements are possible for the ListIconGadget.
Is it possible to refine your function from this:
SetColumnAlignment(Column, Alignment.s)
to this:
SetColumnAlignment(GadgetID,Column, Alignment.s)
I also like to put a window's event handlers in its own code file, so for example I handle gadget events like this:
So I need to figure out how to get the row and column of the cell the user clicked in the ListIconGadget.
Thanks.
Is it possible to refine your function from this:
SetColumnAlignment(Column, Alignment.s)
to this:
SetColumnAlignment(GadgetID,Column, Alignment.s)
I also like to put a window's event handlers in its own code file, so for example I handle gadget events like this:
Code: Select all
Procedure HandleGadgetEvents()
evWindow = EventWindow()
evGadget = EventGadget()
evType = EventType()
evX = 0 : evY = 0
If GadgetType(evGadget) = #PB_GadgetType_Canvas
evX = GetGadgetAttribute(evGadget,#PB_Canvas_MouseX)
evY = GetGadgetAttribute(evGadget,#PB_Canvas_MouseY)
ElseIf GadgetType(evGadget) = #PB_GadgetType_ListIcon
; how to set evX and evY to the cell clicked by the user?
EndIf
Select evWindow
Case #frmHeadings
frmHeadings_GadgetEvents(evGadget,evType,evX,evY)
; etc...
EndSelect
EndProcedure
BindEvent(#PB_Event_Gadget,@HandleGadgetEvents())
Thanks.
Re: ListIconGadget - right align a column's content
[X] Done. It's now integrated in my ListIconGadgetEx-Module (see below).the.weavster wrote:Is it possible to refine your function from this: [...] to this:
SetColumnAlignment(GadgetID,Column, Alignment.s)
please take a look at this repository: https://github.com/spiderbytes/ListIconGadgetEx (BindCellClick)the.weavster wrote:So I need to figure out how to get the row and column of the cell the user clicked in the ListIconGadget.
Greetings ... Peter
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: ListIconGadget - right align a column's content
Thanks again, Peter.
Sorry to be a pain in the neck but would it be possible to to enhance the row color commands so the colors can be set on a gadget by gadget basis?
i.e.
becomes:
Thanks.
Sorry to be a pain in the neck but would it be possible to to enhance the row color commands so the colors can be set on a gadget by gadget basis?
i.e.
Code: Select all
SetEvenRowColor(RowColor.s, SelectedRowColor.s, TextColor.s, SelectedTextColor.s)
Code: Select all
SetEvenRowColor(Gadget, RowColor.s, SelectedRowColor.s, TextColor.s, SelectedTextColor.s)
Re: ListIconGadget - right align a column's content
[X] Done: https://github.com/spiderbytes/ListIconGadgetExthe.weavster wrote:would it be possible to to enhance the row color commands so the colors can be set on a gadget by gadget basis?
Greetings ... Peter
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: ListIconGadget - right align a column's content
Thank you, Peter
-
- Posts: 284
- Joined: Fri Sep 22, 2017 7:02 am
Re: ListIconGadget - right align a column's content
Thank you Peter. Would it be possible to extend the ListiconGadget() that you can sort with it?