User Tools

Site Tools


prop_touched.htm
Navigation:  Language Reference > App C - PROP: Runtime Properties > Complete Property List >====== PROP:Touched ====== Previous pageReturn to chapter overviewNext page

When non-zero, indicates the data in the ENTRY, TEXT, SPIN, or COMBO control with input focus has been changed by the user since the last EVENT:Accepted. This is automatically reset to zero each time the control generates an EVENT:Accepted. Setting this property (in EVENT:Selected) allows you to ensure that EVENT:Accepted generates to force data validation code to execute, overriding Windows' standard behavior–simply pressing TAB to navigate to another control does not automatically generate EVENT:Accepted.

PROP:Touched can also be interrogated to determine if the content of a BLOB has changed since it was retrieved from disk.

Example:

WinView WINDOW('View'),AT(0,0,320,200),MDI,MAX,HVSCROLL

        ENTRY(@S30),AT(0,0,320,180),USE(Fil:Field)

        BUTTON('Ok'),AT(100,180,20,20),USE(?Ok)

        BUTTON('Cancel'),AT(200,180,20,20),USE(?Cancel)

       END

SaveCancelPos LONG,DIM(4)

CODE

OPEN(WinView)

SaveCancelPos[1] = ?Cancel{PROP:Xpos}       !Save Cancel button area

SaveCancelPos[2] = ?Cancel{PROP:Xpos}+?Cancel{PROP:Width}

SaveCancelPos[3] = ?Cancel{PROP:Ypos}

SaveCancelPos[4] = ?Cancel{PROP:Ypos}+?Cancel{PROP:Height}

ACCEPT

 CASE FIELD()

 OF ?Fil:Field

  CASE EVENT()

  OF EVENT:Selected

   ?Fil:Field{PROP:Touched} = 1         !Force EVENT:Accepted to generate

  OF EVENT:Accepted

   IF KEYCODE() = MouseLeft AND  |       !Detect user clicking on Cancel

     INRANGE(MOUSEX(),SaveCancelPos[1],SaveCancelPos[2]) AND |

     INRANGE(MOUSEY(),SaveCancelPos[3],SaveCancelPos[4])

    CYCLE                   !User clicked on Cancel

   ELSE

   !Process the data, whether entered by the user or in the field at the start

  END

 OF ?Ok

  CASE EVENT()

  OF EVENT:Accepted

   !Write the data to disk

  END

 OF ?Cancel

  CASE EVENT()

  OF EVENT:Accepted

   !Do not write the data to disk

  END

 END

END

prop_touched.htm.txt · Last modified: 2021/04/15 15:57 (external edit)