Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: ReportView Selected vs Checked Checkbox ListView Highlighted
#DefineSubRoutine MyDialogCallbackProc(MyDialog_Handle,MyDialog_Message,MyDialog_Name,MyDialog_EventInfo,MyDialog_ChangeInfo) MSG_INIT=0 ; The one-time initialization MSG_BUTTONPUSHED=2 ; Pushbutton or Picturebutton MSG_RVITEMSELROW=18 ; Reportview item select row MSG_RVCHECKEDITEM=20 ; Reportview checked/unchecked Item DC_CHECKBOX=1 DC_TITLE = 4 ;Return code constants RET_DO_CANCEL=0 ; Cancels dialog RET_DO_DEFAULT= -1 ; Continue with default processing for control RET_DO_NOT_EXIT= -2 ; Do not exit the dialog ON_EQUAL = @TRUE ; Initialize variable ON_EQUAL Switch MyDialog_Message ; Switch based on Dialog Message type Case MSG_INIT ; Standard Initialization message DialogProcOptions(MyDialog_Handle,MSG_BUTTONPUSHED,@TRUE) DialogProcOptions(MyDialog_Handle,MSG_RVITEMSELROW,@TRUE) DialogProcOptions(MyDialog_Handle,MSG_RVCHECKEDITEM,@TRUE) rowcount = ArrInfo(arrArray, 1) colcount = ArrInfo(arrArray, 2) rowindex = 0 rowindexcb = 0 arrItemsSelected = ArrDimension( rowcount, colcount ) ArrInitialize(arrItemsSelected, '') arrItemsChecked = ArrDimension( rowcount, colcount ) ArrInitialize(arrItemsChecked, '') Return(RET_DO_DEFAULT) Case MSG_RVITEMSELROW ; !!!!!!!!! HANDLE ITEM SELECTIONS !!!!!!!!!!!!!!!!!! ;Pause('MyDialog_ChangeInfo',MyDialog_ChangeInfo) ;Create an array to store the results indexSelected = Arraysearch( arrArray, MyDialog_ChangeInfo) arrItemsSelected[rowindex,0] = arrArray[indexSelected,0] arrItemsSelected[rowindex,1] = arrArray[indexSelected,1] ;Pause('SELECTED Item',arrArray[indexSelected,0]:',':arrArray[indexSelected,1]) rowindex = rowindex+1 Return(RET_DO_NOT_EXIT) Case MSG_RVCHECKEDITEM ; !!!!!!!!! HANDLE CHECKBOX SELECTIONS !!!!!!!!!!!!!!!!!! ;Pause('MyDialog_ChangeInfo',MyDialog_ChangeInfo) indexChecked = Arraysearch( arrArray, MyDialog_ChangeInfo) arrItemsChecked[rowindexcb,0] = arrArray[indexChecked,0] arrItemsChecked[rowindexcb,1] = arrArray[indexChecked,1] ;Pause('CHECKED Item',arrArray[indexChecked,0]:',':arrArray[indexChecked,1]) rowindexcb = rowindexcb+1 Return(RET_DO_NOT_EXIT) Case MSG_BUTTONPUSHED If MyDialog_Name == "PushButton_SelectAll" For x = 0 To ArrInfo(arrArray, 1)-1 item = arrArray[x,0] DialogControlSet( MyDialog_Handle, "ReportView_1", DC_CHECKBOX, item ) Next state = DialogControlGet( MyDialog_Handle, "PushButton_SelectAll", DC_TITLE ) If state == 'UnSelect All' DialogControlSet( MyDialog_Handle, "PushButton_SelectAll", DC_TITLE, 'Select All' ) Else DialogControlSet( MyDialog_Handle, "PushButton_SelectAll", DC_TITLE, 'UnSelect All' ) EndIf Return(RET_DO_NOT_EXIT) ElseIf MyDialog_Name == "PushButton_Cancel" ; Cancel Return(RET_DO_CANCEL) ElseIf MyDialog_Name == "PushButton_OK" ; OK Return(RET_DO_DEFAULT) EndIf ; MyDialog_Name Return(RET_DO_DEFAULT) EndSwitch ; MyDialog_Message Return(RET_DO_DEFAULT) #EndSubRoutine ; End of Dialog Callback MyDialogCallbackProc filename = 'C:\TEMP\Data\CSV\Authors.csv' arrArray = ArrayFileGetCSV(filename, 1) MyDialogFormat=`WWWDLGED,6.2` MyDialogCaption=`ReportView Select all` MyDialogX=138 MyDialogY=141 MyDialogWidth=566 MyDialogHeight=243 MyDialogNumControls=004 MyDialogProcedure=`MyDialogCallbackProc` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`165,223,036,012,PUSHBUTTON,"PushButton_SelectAll",DEFAULT,"Select All",2,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`265,223,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,32,DEFAULT,DEFAULT,DEFAULT` MyDialog003=`365,223,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog004=`187,063,174,100,REPORTVIEW,"ReportView_1",arrArray,DEFAULT,DEFAULT,30,142606336,DEFAULT,DEFAULT,"192|192|192"` ButtonPushed=Dialog("MyDialog") ; Get Checked Items checked = "" For row = 0 To ArrInfo(arrItemsChecked, 1)-1 data = "" For col = 0 To ArrInfo(arrItemsChecked, 2)-1 item = arrItemsChecked[row,col] If data == '' Then data = item Else data = data:'|':item Next If checked == '' Then checked = data Else checked = checked:@TAB:data Next checked = StrTrim(checked) AskItemlist('Checked items', checked, @TAB, @UNSORTED, @SINGLE ) ; Get Selected Items ; The array variable defined in the Reportview ; will contain the selected rows once the dialog returns selected = "" For row = 0 To ArrInfo(arrArray, 1)-1 data = "" For col = 0 To ArrInfo(arrArray, 2)-1 item = arrArray[row,col] If data == '' Then data = item Else data = data:'|':item Next If selected == '' Then selected = data Else selected = selected:@TAB:data Next checked = StrTrim(checked) AskItemlist('Selected items', selected, @TAB, @UNSORTED, @SINGLE ) ; or Get Selected items from callback selectedcb = "" For row = 0 To ArrInfo(arrItemsSelected, 1)-1 data = "" For col = 0 To ArrInfo(arrItemsSelected, 2)-1 item = arrItemsSelected[row,col] If data == '' Then data = item Else data = data:'|':item Next If selectedcb == '' Then selectedcb = data Else selectedcb = selectedcb:@TAB:data Next selectedcb = StrTrim(selectedcb) AskItemlist('Selected items - from callback', selectedcb, @TAB, @UNSORTED, @SINGLE )
Article ID: W17732
Filename: ReportView Select vs Checked.txt
File Created: 2013:07:23:08:05:54
Last Updated: 2013:07:23:08:05:54