ListIconGadget without table header?

Just starting out? Need help? Post your questions and find answers here.
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

ListIconGadget without table header?

Post by Lebostein »

It is possible to hide/tirn off the header of a ListIconGadget?
User avatar
Bisonte
Addict
Addict
Posts: 1232
Joined: Tue Oct 09, 2007 2:15 am

Re: ListIconGadget without table header?

Post by Bisonte »

On Windows you can use the Flag : #LVS_NOCOLUMNHEADER.
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

Re: ListIconGadget without table header?

Post by Lebostein »

Nice! Thanks.
Is there possibility for Mac OS too?
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: ListIconGadget without table header?

Post by Shardik »

Lebostein wrote:Is there possibility for Mac OS too?
http://www.purebasic.fr/english/viewtop ... 5&start=72

Cross-platform for Linux, MacOS and Windows:

Code: Select all

Procedure HideListIconHeader(ListIconID.I)
  CompilerSelect #PB_Compiler_OS
    CompilerCase #PB_OS_Linux
      gtk_tree_view_set_headers_visible_(GadgetID(ListIconID), #False)
    CompilerCase #PB_OS_MacOS
      CocoaMessage(0, GadgetID(ListIconID), "setHeaderView:", 0)
    CompilerCase #PB_OS_Windows
      SetWindowLongPtr_(GadgetID(ListIconID), #GWL_STYLE,
        GetWindowLongPtr_(GadgetID(ListIconID),
        #GWL_STYLE) | #LVS_NOCOLUMNHEADER)
  CompilerEndSelect
EndProcedure

OpenWindow(0, 200, 100, 430, 135, "ListIcon Example")
ListIconGadget(0, 10, 10, WindowWidth(0) - 20, WindowHeight(0) - 50, "Name", 110)
AddGadgetColumn(0, 1, "Address", GadgetWidth(0) - GetGadgetItemAttribute(0, 0,
  #PB_ListIcon_ColumnWidth) - 8)
AddGadgetItem(0, -1, "Harry Rannit" + #LF$ +
  "12 Parliament Way, Battle Street, By the Bay")
AddGadgetItem(0, -1, "Ginger Brokeit" + #LF$ +
  "130 PureBasic Road, BigTown, CodeCity")
AddGadgetItem(0, -1, "Didi Findit" + #LF$ +
  "321 Logo Drive, Mouse House, Downtown")
ButtonGadget(1, WindowWidth(0) / 2 - 70, WindowHeight(0) - 33, 140, 25,
  "Hide title header")

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
    Case #PB_Event_Gadget
      If EventGadget() = 1 And EventType() = #PB_EventType_LeftClick
        HideListIconHeader(0)
        DisableGadget(1, #True)
      EndIf
  EndSelect
ForEver
Last edited by Shardik on Fri May 17, 2019 10:13 am, edited 2 times in total.
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: ListIconGadget without table header?

Post by RSBasic »

Image
Image
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

Re: ListIconGadget without table header?

Post by Lebostein »

@Shardik, RSBasic: Thank YOU!
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4659
Joined: Sun Apr 12, 2009 6:27 am

Re: ListIconGadget without table header?

Post by RASHAD »

I am not sure about Mac & Linux

Code: Select all

LoadFont(0,"Consolas",12)
  
  If OpenWindow(0, 0, 0, 600, 355, "ListIconGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ContainerGadget(0,10,10,580,300,#PB_Container_Flat)
    ListIconGadget(1,  -1,  -25, 580, 400, "Column 1", 100,#PB_ListIcon_GridLines)
    For b = 1 To 4          ; add 3 more columns to each listicon
      AddGadgetColumn(1, b, "Column " + Str(b), 100)
    Next
    For b = 0 To 2          ; add 4 items to each line of the listicons
      AddGadgetItem(1, b, "Item 1"+Chr(10)+"Item 2"+Chr(10)+"Item 3"+Chr(10)+"Item 4")
    Next
    SetGadgetFont(1,FontID(0))
    CloseGadgetList()
    
    ButtonGadget(5,10,320,60,25,"Toggle")

    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Quit =1
          
        Case #PB_Event_Gadget
          Select EventGadget()
            Case 5
              Run ! 1
              If Run = 1
                ResizeGadget(1,-1,-1,580,400)
              Else
                ResizeGadget(1,-1,-25,580,400)
              EndIf
          EndSelect
      EndSelect
    Until Quit = 1
  EndIf
Egypt my love
wombats
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Dec 29, 2011 5:03 pm

Re: ListIconGadget without table header?

Post by wombats »

If using Qt on Linux, you can do:

Code: Select all

QtScript(~"gadget(" + Str(gadget) + ~").headerHidden = \"true\"")
Post Reply