ReportView Default Row and more

Started by seckner, January 29, 2014, 09:02:07 AM

Previous topic - Next topic

seckner

I have a pretty standard ReportView I'm using to track department expenses and it works perfectly. It's for display only since it's a summary of the expenses. That said the final row is the grand total row. Is it possible to 'select' that row so it's highlighted when it's first displayed?

Please excuse me if this has already been answered - can I embed a dialog in a dialog? What I mean is - I have a program dialog that allows me to enter expenses into my database. On that dialog I have a menu and that menu opens the ReportView program - so two separate programs, one calling the other. It's nice and does what I need but what I'd really like is to have the Voucher Sheet AND the ReportView all in one window. Since I'm sure I've confused everyone please see the attached pictures - one of the voucher sheet, winbatch program A, one of the summary Reportview, winbatch program B, and an idea of what I'd like to try to do, picture c. Is it possible?

Thank you!   

JTaylor

DialogControlSet() options 6 and 10 may be of interest.

You can put all the controls on the same dialog.

Jim

seckner

Jim, Thank you! As happens often once I asked the question out loud, I started wondering if I could just combine the 2, and then stumbled on the DialogControlSet() options you mentioned! I very much appreciate your reply - at least now I know I'm on the right track! 

Deana

Yes you can highlight the last item in a ReportView upon display using your Dialog Callback initialization routine. Call DialogControlSet option 6 to select the item then option 10 to scroll to the last item.

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_ITEMBOXSELECT=6        ; ITEMBOX FILELISTBOX DROPLISTBOX REPORTVIEW
   DC_ITEMSCROLLPOS=10       ; ITEMBOX FILELISTBOX
   ;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)
         count = ArrInfo(arrArray, 1)-1
         lastitem = arrArray[count,0]
         DialogControlSet( MyDialog_Handle, "ReportView_1", DC_ITEMBOXSELECT, lastitem ) ;Select
         DialogControlSet( MyDialog_Handle, "ReportView_1", DC_ITEMSCROLLPOS, lastitem ) ;Scroll to
         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_ITEMBOXSELECT, 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=`013,011,540,202,REPORTVIEW,"ReportView_1",arrArray,DEFAULT,DEFAULT,30,8388608,DEFAULT,DEFAULT,"192|192|192"`

ButtonPushed=Dialog("MyDialog")





To have a dialog embedded in a dialog: you would set up a call back procedure, in which you would call the embedded dialog.

Here is some sample code:

Code (winbatch) Select
#DefineFunction MainDialogCallbackProc(MainDialog_Handle,MainDialog_Message,MainDialog_ID,rsvd1,rsvd2)
   ;DialogprocOptions Constants
   MSG_INIT=0                ; The one-time initilization
   MSG_TIMER=1               ; Timer event
   MSG_BUTTONPUSHED=2        ; Pushbutton or Picturebutton
 
   switch MainDialog_Message
      case MSG_INIT

         DialogProcOptions(MainDialog_Handle,MSG_BUTTONPUSHED,@TRUE)
         return(-1)

     case MSG_BUTTONPUSHED  ;ID 001
ChildDialogFormat=`WWWDLGED,6.1`
ChildDialogCaption=`Child Dialog`
ChildDialogX=010
ChildDialogY=050
ChildDialogWidth=150
ChildDialogHeight=100
ChildDialogNumControls=001
ChildDialogProcedure=`DEFAULT`
ChildDialogFont=`DEFAULT`
ChildDialogTextColor=`DEFAULT`
ChildDialogBackground=`DEFAULT,DEFAULT`
ChildDialogConfig=1

ChildDialog001=`050,046,048,010,PUSHBUTTON,DEFAULT,"Push Me",1,1,32,DEFAULT,DEFAULT,DEFAULT`

ChildDialogButtonPushed=Dialog("ChildDialog")


        return(-1)      ;  Do default processing

   endswitch       ; MainDialog_Message
   return(-1)      ;  Do default processing
#EndFunction       ;End of Dialog Callback MainDialogCallbackProc

;============================================================
;============================================================
;============================================================





MainDialogFormat=`WWWDLGED,6.1`

MainDialogCaption=`Main Dialog`
MainDialogX=010
MainDialogY=990
MainDialogWidth=300
MainDialogHeight=200
MainDialogNumControls=001
MainDialogProcedure=`MainDialogCallbackProc`
MainDialogFont=`DEFAULT`
MainDialogTextColor=`DEFAULT`
MainDialogBackground=`DEFAULT,DEFAULT`
MainDialogConfig=1

MainDialog001=`120,090,048,030,PUSHBUTTON,DEFAULT,"Push Me",1,1,32,DEFAULT,DEFAULT,DEFAULT`

MainDialogButtonPushed=Dialog("MainDialog")



Deana F.
Technical Support
Wilson WindowWare Inc.

seckner

Deana - your keyboard has to be smoking! Thank you!!! Between you and Jim I might just figure this out! Again, Thank you!

Deana

Deana F.
Technical Support
Wilson WindowWare Inc.