ListIconGadget - Column alignment
ListIconGadget - Column alignment
Is an example for the column alignment in ListIconGadget available?
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Re: ListIconGadget - Column alignment
I am confused by the term... do you mean a way to automatically expand the column to the length of the largest entry?
Or how ot CENTER text in each column header?

Or how ot CENTER text in each column header?

Re: ListIconGadget - Column alignment
The last one.
How can i align the text in columns in a ListIconGadget in the middle (center) and right (under Linux)?
How can i align the text in columns in a ListIconGadget in the middle (center) and right (under Linux)?
Re: ListIconGadget - Column alignment
The underlying GtkTreeView is quite a beast, so these things are not as simple as in Windows.
Here it is though:
Here it is though:
Code: Select all
ImportC ""
g_object_set_double(*Object, Property.p-ascii, Value.d, NULL) As "g_object_set"
EndImport
; Set Column alignment for given #Gadget and Column
; Alignment should be between 0 and 1
;
Procedure SetColumnAlign(Gadget, Column, Alignment.d)
Protected *Column, *CellRenderers, Count, Index
*Column = gtk_tree_view_get_column_(GadgetID(Gadget), Column)
If *Column
; This only aligns the title text
gtk_tree_view_column_set_alignment_(*Column, Alignment)
; Align the text renderers as well
*CellRenderers = gtk_tree_view_column_get_cell_renderers_(*Column)
If *CellRenderers
Count = g_list_length_(*CellRenderers)
For Index = 0 To Count-1
g_object_set_double(g_list_nth_data_(*CellRenderers, Index), "xalign", Alignment, #Null)
Next Index
g_list_free_(*CellRenderers)
EndIf
EndIf
EndProcedure
If OpenWindow(0, 0, 0, 500, 300, "ListIcon Columns", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ListIconGadget(0, 10, 10, 480, 280, "Left", 150)
AddGadgetColumn(0, 1, "Center", 150)
AddGadgetColumn(0, 2, "Right", 150)
SetColumnAlign(0, 0, 0.0)
SetColumnAlign(0, 1, 0.5)
SetColumnAlign(0, 2, 1.0)
For i = 1 To 10
AddGadgetItem(0, -1, RSet("", i, "A")+Chr(10)+RSet("", i, "A")+Chr(10)+RSet("", i, "A"))
Next i
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
quidquid Latine dictum sit altum videtur
Re: ListIconGadget - Column alignment
This was, what i am looking for. Thank you (für Tannenbäumchen ;-)