; Module/File: LIG_GetSetColumnVisible.pb ; Function: LIG-Sichtbarkeit einzelner Spalten ein- und ausschalten - Linux ; Author: Omi ; Date: Juli 10, 2014 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31/5.40 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit ; Object constants #MainWin= 0 #LIG= 0 #But= 1 #WinX= 200 #WinY= 200 #WinW= 500 #WinH= 450 Global.i gEvent, gQuit ;- Functions ... Procedure LIG_SetColumnVisible(Gadget, Column) Protected *Column *Column = gtk_tree_view_get_column_(GadgetID(#LIG), Column); LINUX-API - get the pointer to the column If *Column If GetGadgetState(#But) gtk_tree_view_column_set_visible_(*Column, #False) Debug "column " + Str(Column+1) + " - visibility now " + Str(gtk_tree_view_column_get_visible_(*Column)) Else gtk_tree_view_column_set_visible_(*Column, #True) Debug "column " + Str(Column+1) + " - visibility now " + Str(gtk_tree_view_column_get_visible_(*Column)) EndIf EndIf EndProcedure ;- ;- Example ... Procedure CreateWindow_Main() Protected.l I, O If OpenWindow(#MainWin, #WinX, #WinY, #WinW, #WinH, "Column 3 visibility", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ListIconGadget(#LIG, 5, 5, 480, 380, "column 1", 70, #PB_ListIcon_AlwaysShowSelection | #PB_ListIcon_GridLines | #PB_ListIcon_CheckBoxes) ButtonGadget(#But, 5, 400, 200, 25, "Column 3 visibility", #PB_Button_Toggle) For O= 1 To 4 AddGadgetColumn(#LIG, O, "column "+Str(O+ 1), 70) Next O For I= 1 To 20 AddGadgetItem(#LIG, -1, Str(I)+".1") Next I For O= 1 To 4 For I= 0 To 19 SetGadgetItemText(#LIG, I, Str(I+1)+"."+Str(O+1), O) Next I Next O For O= 3 To 4 For I= 0 To 19 SetGadgetItemText(#LIG, I, Str(20-I)+"."+Str(O+1), O) Next I Next O EndIf EndProcedure CreateWindow_Main() Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #PB_Event_Gadget If EventGadget()= #But LIG_SetColumnVisible(#LIG, 2) EndIf EndSelect Until gQuit ; IDE Options = PureBasic 5.40 LTS Beta 9 (Linux - x86) ; CursorPosition = 8 ; FirstLine = 22 ; Folding = - ; EnableUnicode ; EnableXP ; CurrentDirectory = /home/charly-xubuntu/Programming/PureBasic/purebasic/