Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Grid Row Selection Behavior
#3
SingleClick To MultiSelect DlgGrid Row

I played around with checkboxes as you suggested and then with hidden checkboxes, then without checkboxes at all, just using whether selected or not. I think this will work for me. Thanks for pointing me in the right direction!
Thanks!,
S


Function SingleClickToMultiSelectDlgGridRow
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages


;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;3 QM_Grid 0x56031041 0x200 2 0 218 110 "0x13,0,0,0,0x840[]#,,7,[]Name,,7,"
;4 Button 0x54032000 0x0 16 114 48 14 "Get Selected"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030605 "" "" "" ""

str controls = "3"
str qmg3x
if(!ShowDialog("SingleClickToMultiSelectDlgGridRow" &SingleClickToMultiSelectDlgGridRow &controls)) ret


ret
;messages
DlgGrid g.Init(hDlg 3)
sel message
,case WM_INITDIALOG
,_s=
,;1,A
,;2,B
,;3,C
,;4,D
,;5,E
,;6,F
,;7,G
,;8,H
,g.FromCsv(_s ",")
,ARRAY(int)+ arrintSelectedRows.create(g.RowsCountGet)
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4 ;;Get Selected
,,ARRAY(int) arrintGetSelectedRows
,,int TotSelectedRows = g.RowsSelectedGet(arrintGetSelectedRows)
,,out "Total Selected Rows = %i:" TotSelectedRows
,,for _i 0 arrintGetSelectedRows.len
,,,out arrintGetSelectedRows[_i]
,,act id(3 hDlg);;to make selected rows visible again

ret 1
;messages3
NMHDR* nh=+lParam
sel nh.idFrom
,case 3
,GRID.QM_NMLVDATA* cd=+nh
,NMLVDISPINFO* di=+nh
,NMLISTVIEW* nlv=+nh
,NMITEMACTIVATE* na=+nh
,sel nh.code
,,
,,;These notifications are from QM_Grid.
,,;All text coming from QM_Grid is in QM format (UTF-8 or ANSI, depending on QM Unicode mode).        
,,case [NM_CLICK,NM_DBLCLK,NM_RCLICK] ;;when user clicks a row or empty space, and it does not begin cell edit mode
,,,out "row click: %i %i" na.iItem na.iSubItem        
,,,
,,,if(arrintSelectedRows[na.iItem])
,,,,arrintSelectedRows[na.iItem] = 0
,,,else
,,,,arrintSelectedRows[na.iItem] = 1
,,,for _i 0 g.RowsCountGet
,,,,if(arrintSelectedRows[_i])
,,,,,g.RowSelect(_i 1)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)