WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Editor version 6.2
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Reportview Select All Checkboxes

 Keywords: Reportview Check Select All Checkboxes DialogControlSet DC_CHECKBOX Array CSV ArrayfileGetCSV

Question:

I am building a dialog that is using the report view that comes with winbatch. I have enabled the multi-line select and checkbox ability of the report view control. It is also using a csv file's information to populate the rows. I would like to incorporate a "select all" push button selects all or the rows checkbox. The help section eludes to this capability and using the "DialogControlSet(WsDialog_Handle,"ReportView_1",1,1)" will select the first row but no other and not multiple ones. Can someone describe how to implement this functionality? If capable.

Answer:

Here is an undebugged code sample. It reads the csv file into an array then loops thru the elements setting each check box.
#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
   DC_CHECKBOX=1             ; CHECKBOX REPORTVIEW
   ;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)
         Return(RET_DO_DEFAULT)

     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
             Return(RET_DO_NOT_EXIT)
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ElseIf MyDialog_Name == "PushButton_Cancel"        ; Cancel
              Return(RET_DO_CANCEL)

        EndIf                                              ; MyDialog_Name
        Return(RET_DO_DEFAULT)

;     case MSG_RVITEMSELROW                                 ; ID "ReportView_1"  arrSafeArray
;        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=003
MyDialogProcedure=`MyDialogCallbackProc`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`165,223,036,012,PUSHBUTTON,"PushButton_SelectAll",DEFAULT,"Select All",1,10,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`365,223,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`187,063,174,100,REPORTVIEW,"ReportView_1",arrArray,DEFAULT,DEFAULT,30,142606336,DEFAULT,DEFAULT,"192|192|192"`

ButtonPushed=Dialog("MyDialog")

Article ID:   W17731
Filename:   Reportview Select All Checkboxes.txt
File Created: 2013:03:18:07:51:26
Last Updated: 2013:03:18:07:51:26