Hide Columns of a ListIconGadget???

Mac OSX specific forum
User avatar
stefanpape
User
User
Posts: 12
Joined: Sun Aug 04, 2013 11:12 am

Hide Columns of a ListIconGadget???

Post by stefanpape »

If I set the ColumnWidth of a column in a ListIconGadget to zero, in Windows you see nothing of the column.
If you make the same in MacOSX, the ColumnWidth isn't zero, you see the column.

Has somebody an idea, how I can hide a column of a ListIconGadget in Mac OS X?

Thank you very much for the help.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Hide Columns of a ListIconGadget???

Post by wilbert »

Code: Select all

If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
   AddGadgetColumn(0, 1, "Address", 250)
   AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
   AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
   
   Columns = CocoaMessage(0, GadgetID(0), "tableColumns")
   Column0 = CocoaMessage(0, Columns, "objectAtIndex:", 0)
   CocoaMessage(0, Column0, "setHidden:", #YES)
   
   Repeat
     Event = WaitWindowEvent()
   Until Event = #PB_Event_CloseWindow
 EndIf
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
stefanpape
User
User
Posts: 12
Joined: Sun Aug 04, 2013 11:12 am

Re: Hide Columns of a ListIconGadget???

Post by stefanpape »

Cool, Thank you very much!
User avatar
deseven
Enthusiast
Enthusiast
Posts: 362
Joined: Wed Jan 12, 2011 3:48 pm
Location: Serbia
Contact:

Re: Hide Columns of a ListIconGadget???

Post by deseven »

Thanks!

I wrapped it into procedure for simplicity:

Code: Select all

Procedure ListIconGadgetHideColumn(gadget.i,index.i,state.b)
  Protected column = CocoaMessage(0,CocoaMessage(0,GadgetID(gadget),"tableColumns"),"objectAtIndex:",index)
  If column
    If state
      CocoaMessage(0,column,"setHidden:",#YES)
    Else
      CocoaMessage(0,column,"setHidden:",#NO)
    EndIf
  EndIf
EndProcedure
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

Re: Hide Columns of a ListIconGadget???

Post by Lebostein »

deseven wrote:Thanks!

I wrapped it into procedure for simplicity:

Code: Select all

Procedure ListIconGadgetHideColumn(gadget.i,index.i,state.b)
  Protected column = CocoaMessage(0,CocoaMessage(0,GadgetID(gadget),"tableColumns"),"objectAtIndex:",index)
  If column
    If state
      CocoaMessage(0,column,"setHidden:",#YES)
    Else
      CocoaMessage(0,column,"setHidden:",#NO)
    EndIf
  EndIf
EndProcedure
It seems this not work, if you add icons to the ListIconGadget. If you add an icon, PureBasic adds a new undefined column at the first position of the ListIconGadget and the gadget gets a column offset - very strange. Can somebody explain that?
User avatar
C87
Enthusiast
Enthusiast
Posts: 176
Joined: Mon Jul 17, 2017 7:22 am
Location: Cotswolds England

Re: Hide Columns of a ListIconGadget???

Post by C87 »

Hi stefanpape,
Don't know if these Topic Headers will help, or if any use on Mac. But here they are anyway :)

Listicon, Hide-Unhide columns by clicking on Listicon Header

Clear columns from list icon gadget?
If it's falling over......just remember the computer is never wrong!
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Hide Columns of a ListIconGadget???

Post by mk-soft »

Icons and CheckBoxes have their own Columns, so the other Columns move to the back.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

Re: Hide Columns of a ListIconGadget???

Post by Lebostein »

mk-soft wrote:Icons and CheckBoxes have their own Columns, so the other Columns move to the back.
But how I find out, if these extra columns are active? It seems these colums are added and removed "on the flow"?
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Hide Columns of a ListIconGadget???

Post by mk-soft »

Its late, i go to sleep...

Show here: viewtopic.php?f=19&t=72124

Code: Select all

*Column0 = CocoaMessage(0, CocoaMessage(0, *TableView, "tableColumns"),
                            "objectAtIndex:", 0)
    
    Ident = PeekS(CocoaMessage(0, CocoaMessage(0, *Column0, "identifier"),
                          "UTF8String"), -1, #PB_UTF8)
    If Ident = "Image"
      ColumnOffset + 1
    ElseIf Ident = "CheckBox"
      ColumnOffset + 1
    
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

Re: Hide Columns of a ListIconGadget???

Post by Lebostein »

mk-soft wrote:Its late, i go to sleep...

Show here: viewtopic.php?f=19&t=72124

Code: Select all

...
Great! Exactly what I was looking for! Thanks!!!!
Post Reply