ListIconGadget - Get Event for Selected Column

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Cantor.

Hi!

Is it possible to get the Event-Number of the selected column of a ListIconGadget, if ChangeListIconGadgetDisplay is set to 3 (column mode)?

EventGadgetID() only returns the GadgetNumber.
What Function returns the selected column?


--
Best regards,
Martin
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Kale.

any ideas on this guys? i am trying to catch the event triggered by clicking on the column headings/(buttons) to enable sorting by column.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fweil.

...,

About sorting items by clicking at column head you should start with this tip from El_Choni.

viewtopic.php?t=869

Let me know if any trouble with, I have working programs using it.


Francois Weil
14, rue Douer
F64100 Bayonne
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

To get the column index you need to work with the windows api:

Code: Select all

Structure NMLISTVIEW
  hdr.NMHDR
  iItem.l
  iSubItem.l
  uNewState.l
  uOldState.l
  uChanged.l
  ptAction.POINT
  lParam.l
EndStructure

;window callback
procedure wndproc(hwnd,msg,wparam,lparam)
shared hlv
ret=#PB_ProcessPureBasicEvents
  
  select msg
    
    case #WM_NOTIFY
      *pnmhdr.NMHDR=lparam
      if *pnmhdr\code=#LVN_COLUMNCLICK   ;column click
        *pnmlistview.NMLISTVIEW=lparam
        if *pnmlistview\hdr\hwndFrom=hlv ;comes from our listicon
          column=*pnmlistview\iSubItem
          messagerequester("",str(column),0)
        endif
      endif

  endselect
procedurereturn ret
endprocedure


hwnd=openwindow(0,100,100,300,150,#PB_Window_SystemMenu,"Column Click")
creategadgetlist(hwnd)

hlv=ListIconGadget(1,10,10,250,100,"Column 0",80)

AddGadgetColumn(1,1,"Column 1",80)
AddGadgetColumn(1,2,"Column 2",80)

setwindowcallback(@wndproc())

repeat
until waitwindowevent()=#PB_EventCloseWindow 
Mike
New User
New User
Posts: 9
Joined: Fri May 16, 2003 11:32 am
Location: Germany

Post by Mike »

Great !

Does anybody know, what code needs to be added to the callback
to get also the selected row information ?

(I want to determine which row, col in the Gadget was clicked by the User)

Thanks,
Mike
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Look ad my example in the other thread :wink:

row=*pnmlistview\iItem

That's the row.

Timo
quidquid Latine dictum sit altum videtur
Post Reply