Page 1 of 1

CountGadgetColumns() Oh please!!!

Posted: Fri Feb 22, 2008 2:08 am
by Rook Zimbabwe
I think we need this feature. I do not see anythign in the docs about it and a search of the threads has revealed NADA!!!

I am having to carry a FLAG with the number of columns currently in my single #ListIcon_THING :?

Is it possible?

Posted: Fri Feb 22, 2008 5:54 am
by Fangbeast

Code: Select all

Procedure.l CountGadgetColumns(MyListIconGadget.l)
  ListIconGadgetHandle.l = SendMessage_(GadgetID(#MyListIconGadget), #LVM_GETHEADER, 0, 0)     ; Get collumn header
  numcols.l  = SendMessage_( ListIconGadgetHandle, #HDM_GETITEMCOUNT, 0, 0)                             ; Get number of collumns in header
	ProcedurReturn NumCols
EndProcedure

Posted: Fri Feb 22, 2008 7:36 am
by citystate
Fangbeast wrote:

Code: Select all

Procedure.l CountGadgetColumns(MyListIconGadget.l)
  ListIconGadgetHandle.l = SendMessage_(GadgetID(#MyListIconGadget), #LVM_GETHEADER, 0, 0)     ; Get collumn header
  numcols.l  = SendMessage_( ListIconGadgetHandle, #HDM_GETITEMCOUNT, 0, 0)                             ; Get number of collumns in header
	ProcedurReturn NumCols
EndProcedure
that's fine if you're happy relying on the API, but what about crossplatform?

Posted: Fri Feb 22, 2008 9:37 am
by Fangbeast
citystate wrote:
Fangbeast wrote:

Code: Select all

Procedure.l CountGadgetColumns(MyListIconGadget.l)
  ListIconGadgetHandle.l = SendMessage_(GadgetID(#MyListIconGadget), #LVM_GETHEADER, 0, 0)     ; Get collumn header
  numcols.l  = SendMessage_( ListIconGadgetHandle, #HDM_GETITEMCOUNT, 0, 0)                             ; Get number of collumns in header
	ProcedurReturn NumCols
EndProcedure
that's fine if you're happy relying on the API, but what about crossplatform?
No idea, but then, Rook didn't ask for a crossplatform solution. Instead of a separate flag, you could store the count in the item by using SetGadgetItemData(), it's in the manual.

Until the team see fit to add a native command.

Posted: Fri Feb 22, 2008 8:56 pm
by Rook Zimbabwe
Thats what i am asking for... a native command AND a fix of RemovegadgetColumn() as well! 8) 8) 8)

Posted: Sat Feb 23, 2008 12:26 pm
by Tranquil
Maybe we can expand the CountGadgetItems() command to a #Flag option where, when flag is set to #PB_Count_Columns is set, it returns the number of columns instead of items.