WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: RAK on December 16, 2013, 10:43:41 AM

Title: itemlistbox @multiple
Post by: RAK on December 16, 2013, 10:43:41 AM
Can I get an itemlistbox in a dialog (has a callback) to act like the askitemlist function when set to @multiple? I would like to allow multiple item selection without holding the control key in an itemlistbox.  Thanks
Title: Re: itemlistbox @multiple
Post by: Deana on December 16, 2013, 11:01:41 AM
Sorry control key is necessary when selecting multiple items in a Dialogs ItemListBox. How about using a button to launch the AskItemList box from your dialog?
Title: Re: itemlistbox @multiple
Post by: RAK on December 16, 2013, 11:14:03 AM
That's what I suspected after looking for awhile. A popup list is not a useable solution as there are 4 radio buttons that control list content. Thanks for your reply Deana.
Title: Re: itemlistbox @multiple
Post by: td on December 16, 2013, 11:26:28 AM
You could use a single column REPORTVIEW control with check boxes.
Title: Re: itemlistbox @multiple
Post by: RAK on December 16, 2013, 11:42:23 AM
You took the thought right out of My head.. Was contemplating just that! I did try the report view functions in the dialog at first just to check it out and switched back to the itemlist. At that time - I did not see any benefits for this dialog and wanted the extra space the checkboxes used. Now I guess there is at least one benefit for me here. Thanks!

I am going to try using both itemlistbox and reportview in the same dialog. depending on what radio button is selected.. Itembox will hide and reportview show for lists that will allow multiple selection..  Talking about it here created a solution! - as usual.

thanks!
Title: Re: itemlistbox @multiple
Post by: Deana on December 16, 2013, 12:02:42 PM
Yes, a ReportView seems to allow similar item selection to the AskItemList.

Code (winbatch) Select
#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]
                 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


list=FileItemize("*.*")
arrArray=Arrayize(list,@TAB)



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=`087,063,387,100,REPORTVIEW,"ReportView_1",arrArray,DEFAULT,DEFAULT,30,DEFAULT,DEFAULT,DEFAULT,"192|192|192"`

ButtonPushed=Dialog("MyDialog")