; Module/File: LIG_TooltipOnColumnHeader_Gtk3.pb ; Function: ListIconGadget, add tooltip on columns-header - Linux gtk3 ; Author: Omi ; Date: Oct. 17, 2016 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31/5.40/5.5/5.6 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit ImportC "" gtk_tree_view_column_get_button(*tree_column.GtkTreeViewColumn) gtk_tree_view_column_get_widget(*tree_column.GtkTreeViewColumn) gtk_widget_set_tooltip_text(*widget.GtkWidget, text.p-utf8) EndImport ; Object constants #MainWin= 0 #LIG = 0 Global.i gEvent, gQuit Procedure TV_ColumnHeaderTooltip_Set(Gadget, Column, ToolTipText.s) Protected *Column= gtk_tree_view_get_column_(GadgetID(Gadget), Column) Protected *Button= gtk_tree_view_column_get_button(*Column) If *Button gtk_widget_set_tooltip_text(*Button, ToolTipText) EndIf EndProcedure Procedure CreateWindow_Main() Protected.i I If OpenWindow(#MainWin, 200, 200, 500, 400, "ColumnsHeaderTooltip Gtk3", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ListIconGadget(#LIG, 5, 5, 490, 390, "Column 0", 90, #PB_ListIcon_AlwaysShowSelection | #PB_ListIcon_GridLines) For I= 1 To 4 AddGadgetColumn(#LIG, I, "Column "+Str(I), 90) Next I For I= 0 To 19 AddGadgetItem(#LIG, -1, "Cell " + Str(I) + "-0" + #LF$ + "Cell " + Str(I) + "-1" + #LF$ + "Cell " + Str(I) + "-2" + #LF$ + "Cell " + Str(I) + "-3" + #LF$ + "Cell " + Str(I) + "-4") Next I TV_ColumnHeaderTooltip_Set(#LIG, 0, "This is header-column 0") TV_ColumnHeaderTooltip_Set(#LIG, 1, "This is header-column 1") TV_ColumnHeaderTooltip_Set(#LIG, 2, "This is header-column 2") TV_ColumnHeaderTooltip_Set(#LIG, 3, "This is header-column 3") TV_ColumnHeaderTooltip_Set(#LIG, 4, "This is header-column 4") EndIf EndProcedure CreateWindow_Main() Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True EndSelect Until gQuit ; IDE Options = PureBasic 5.45 LTS (Linux - x86) ; CursorPosition = 34 ; Folding = - ; EnableUnicode ; EnableXP