Two Questions...

Hopefully I got this in the correct forum.   I've done some extensive searching and could not find exactly what I was looking for.     Here are my questions:

1. We are implementing the ability to Copy/Cut/Paste using the Windows functions (Ctrl C, X, V, etc).   This all works great, except for grid entry fields.  I've seen that there was some issues with this before, but I don't believe there was an actual resolution to the issue.   I've tried debugging through the grid entry handling and when running the Paste function (Ctrl V), the grid acts like I am leaving the field (event 16393).   I can use Shift Insert and right-click, Paste with success, but I wanted to have consistent functionality going forward.    Is there a way yet to implement these functions in a grid?   

2.  I've also done some work trying to get a calendar button added to our date entry fields.   We've fooled around with the "Date Entry" control type and it works great, but our users are data entry heavy users and I'm sure the whole "adding a slash between mm/dd/yyyy" will ignite their tempers.   I've seen some talk about using an Active-X control, but I do not see the control in the AxDefGen tool (note, I am a Windows 8 user now).    So, in short, is there a way to add a simple button to select a date and pass it back to allow use in a regular text entry field? 


Thank you for any support you can provide.  I did try searching for these answers before posting, but just did not have any luck finding the exact answers. 

  • #1 .. To use Windows standard cut/copy/paste commands ctrl-c, ctrl-v, etc.

    In the configuration file you position this (for example):

    KEYSTROKE EXCEPTION=1001 ^C

    KEYSTROKE EXCEPTION=1002 ^X

    KEYSTROKE EXCEPTION=1003 ^V

    And then on your program you set this

    SET EXCEPTION 1001 TO COPY-SELECTION

    SET EXCEPTION 1002 TO CUT-SELECTION

    SET EXCEPTION 1003 TO PASTE-SELECTION

    #2 Have you tried a Microsoft Calendar control ... I think you'll find that it matches our date control pretty closely ..I hope this helps ...

          IDENTIFICATION DIVISION.

          PROGRAM-ID. DATEENTRY.

          DATA DIVISION.

          WORKING-STORAGE SECTION.

          COPY "ACUGUI.DEF".

          COPY "CRTVARS.DEF".

          77  KEY-STATUS IS SPECIAL-NAMES CRT STATUS PIC 9(4) VALUE 0.

          01  DATE-PAID PIC 9(8).

          01  date-paid1 redefines date-paid.

              05 date-yr  pic 9999.            

              05 date-mth pic 99.

              05 date-day pic 99.

          01  date-paid2.

              05 date-yr2 pic 9999.

              05 dash-1 pic x value "/".

              05 date-mth2 pic 99.

              05 dash-2 pic x value "/".

              05 date-day2 pic 99.

          01  win-handle handle of window.

          SCREEN SECTION.

          01  MAIN-SCREEN.

              05  PUSH-BUTTON CANCEL-BUTTON.

              05  LABEL "P&Ymt:"          COL 10.                          2C111008

              05  DP DATE-ENTRY SHORT-DATE VALUE DATE-PAID SIZE 10         2C111008

                  EVENT FIND-AGAIN NOTIFY-CHANGE.                          2C111708

              05  LBL1 label title "Date is now:" line 1 col 27.

              05  LBL2 entry-field using date-paid col 35.

              05  LBL3 label title "Formatted:" line 2 col 27.

              05  LBL4 entry-field using date-paid2 col 35.

          PROCEDURE DIVISION.

          BEGIN.

              DISPLAY standard GRAPHICAL WINDOW

                   SCREEN LINE 200, SCREEN COLUMN 50,

                   LINES 20, SIZE 45, CELL HEIGHT 10,                

                   CELL WIDTH 10, AUTO-MINIMIZE, COLOR IS 65793,    

                   MODELESS, WITH SYSTEM MENU, LINK TO THREAD,                      

                   TITLE "DATE CONTROL TEST", TITLE-BAR,                    

                   HANDLE IS win-handle.

              DISPLAY MAIN-SCREEN.

              PERFORM UNTIL KEY-STATUS = 27

                ACCEPT MAIN-SCREEN

              END-PERFORM

              GOBACK.

          FIND-AGAIN.                                                      2C111708

              EVALUATE EVENT-TYPE                                          2C111708

              WHEN NTF-CHANGED                                             2C111708

                   INQUIRE DP VALUE IN DATE-PAID                           2C111708

                   move date-yr  to date-yr2

                   move date-mth to date-mth2

                   move date-day to date-day2

                   DISPLAY LBL2      LBL4

              END-EVALUATE.                                                2C111708

  • On #1, yes, I've used this and it works great with most form controls (entry fields, etc).   It does not work with the grid control.   We have an "Order Entry" program that allows for users to enter in stock #'s, etc.    When trying to paste into the grid field, the system does not allow it to work.   In debug it acts like it is exiting the entry field, which triggers our MSG-FINISH-ENTRY event.   Shift Insert (an alternate way of doing Ctrl V) does exactly what it needs to, so it seems that there is something weird here that I am missing.

    On #2, the date entry field would work great, but it does not allow for continuous typing.   For example, date format MMDDYY, our users would enter in 012813 and we would handle the back end validation, etc with an AFTER procedure.    With the date entry field, you have to explicitly type in 01/28/2013 for it to continue.   So, I guess what I am getting at is that I would like to have the convenience of the free form typing in the regular entry field and the calendar display of the date entry field.  I know that there would be additional validation, etc, but we already do that.    Simply put, just looking for a button to pop the calendar so we can get a date from that.   

    Edit... I guess I do need to look into the Microsoft Control, but I'm not sure how to get at it to use it.   I do not see it in the AxDefGen tool, so I'm not sure how to generate it.  

  • Verified Answer

    #1 Yes, I should have paid more attention to your request. We have had people ask for an enhancement to the grid for the Ctrl C, X, however currently the only available workaround is to use CTRL INS and CTRL CANC.

  • #2 you can have 3 entry fields all arranged so they appear as a single field, and you could use the AUTO property so that when 01 is entered (or month) the cursor is now in the 2nd entry field, use AUTO to get to the third field, have the third field preloaded with 20 and use the CURSOR property so that the cursor is set at the third didgit so that typers will just type in the 2 digit year.

  • #1 - Thanks, that's what I was figuring, but wanted to make sure not to leave any stone unturned.

    #2 - I think you're really onto something with this date thing.    Could you possibly show me how that screen section field would look broken up like that?   I'm curious how that would tie together with the DATE-ENTRY field.  

    Thanks for all of your help!

  • #2 try out this working storage and screen section ... just display and accept and see if it is close to what you are after ...

     77 Form1-Ef-1-Valuea            PIC  99.

          77 Form1-Ef-1-Valueb            PIC  99.

          77 Form1-Ef-2-Valuea            PIC  99

                     VALUE IS 20.

          77 Form1-Ef-2-Valueb            PIC  99.

          77 Form1-Ef-3-Value PIC  x

                     VALUE IS "/".

         *{Bench}end

          LINKAGE                     SECTION.

         *{Bench}linkage

         *{Bench}end

          SCREEN                      SECTION.

         *{Bench}copy-screen

          01 Form1.

              03 Form1-Ef-1, Entry-Field,

                 COL 7.00, LINE 6.00, LINES 2.00 CELLS, SIZE 2.00 CELLS,

                 AUTO, NO-BOX, ID IS 1, MAX-TEXT 2,

                 VALUE Form1-Ef-1-Valuea.

              03 Form1-Ef-1a, Entry-Field,

                 COL 11.00, LINE 6.00, LINES 2.00 CELLS, SIZE 2.00 CELLS,

                 AUTO, NO-BOX, ID IS 2, MAX-TEXT 2,

                 VALUE Form1-Ef-1-Valueb.

              03 Form1-Ef-2a, Entry-Field,

                 COL 17.00, LINE 6.00, LINES 2.00 CELLS, SIZE 2.00 CELLS,

                 NO-BOX, ID IS 5, MAX-TEXT 2, VALUE Form1-Ef-2-Valueb.

              03 Form1-Ef-2, Entry-Field,

                 COL 15.00, LINE 6.00, LINES 2.00 CELLS, SIZE 2.00 CELLS,

                 AUTO, NO-BOX, ID IS 3, MAX-TEXT 2,

                 VALUE Form1-Ef-2-Valuea.

              03 Form1-Fr-1, Frame,

                 COL 7.00, LINE 5.00, LINES 4.00 CELLS, SIZE 13.00 CELLS,

                 ENGRAVED, ID IS 4, BACKGROUND-LOW.

              03 Form1-Ef-3, Entry-Field,

                 COL 9.00, LINE 6.00, LINES 2.00 CELLS, SIZE 1.00 CELLS,

                 NO-BOX, ENABLED 0, ID IS 6, VALUE Form1-Ef-3-Value.

              03 Form1-Ef-3a, Entry-Field,

                 COL 14.00, LINE 6.00, LINES 2.00 CELLS, SIZE 1.00 CELLS,

                 NO-BOX, ENABLED 0, ID IS 7, VALUE Form1-Ef-3-Value.

  • It's close, the display formatting can definitely be used.   The problem is that the calendar button does not appear.  So, we have one issue (enter date in) solved but one issue unsolved (launch calendar with button).

  • Verified Answer

    The date control or Microsoft's Excel dt picker doesn't seem to be able to be popped to the calendar via push button ... I found an ActiveX Calendar control on CNet ... download.cnet.com/.../3000-2206_4-10599481.html I downloaded this, register the ocx, added it to AcuBench, placed it on my screen (made it invisible, added a push button which makes the calendar visible .. works nicely ... can't really share it as you have to download and register the control to use it.

  • Thanks shjerpe for all of your help.     The only issue with the control above is that it does come with a price tag (which isn't too bad, but it does come down to a value proposition).   I tried it out and it works.   I also found out why I couldn't see the MS Calendar object and thought I would share this:

    answers.microsoft.com/.../03ad5d05-ca3f-4081-9989-e757223ebdde

    So, basically, MS removed it from Office 2010 and on.  I'm using Office 2013 with Windows 8, so that explains everything.  

    We'll take a look at these and see if we can use them.   Thanks again.