wiki:Docs/Prog/Manual/ApplicationLibraries/lib825ev/Form/IN_EVENT_WRITE_DATA

IN_EVENT_WRITE_DATA

Standard form behavior is that if the form is exited by escape or left arrow any changes are lost. This also is the case if an "EXIT" button is provided on the form. The exit button will call an event that will return nonzero to cause the form to exit. It is often useful to prompt the user in this instance whether to keep any changes. The IN_EVENT_WRITE_DATA macro when used in a form done event will write the changed data.

IN_EVENT_WRITE_DATA

Parameters

  • None

Return Value

This function does not return any value

Remarks

IN_EVENT_WRITE_DATA is a macro to the call to form WriteData within a form event. The preprocessor will replace this with a call to the WriteData function of the form.

#define IN_EVENT_WRITE_DATA pForm->WriteData()

Examples

The FORM_INIT must have EventInputDone specified for the done event parameter. such as

  FORM_INIT(EditTruck, EventEditTruckShow, NULL, NULL, EventInputDone, nFormFlgNone);
EVENT(InputDone) 
{
   if(nData == FORM_DONE_ESCAPE || nData == FORM_DONE_LEFT_ARROW)
   {
      if (pForm->IsChanged() == true)
      {
         if(WaitPrompt(LANG(STR_SAVE_CHANGES), LANG(STR_YES), LANG(STR_NO)) == true)
         {
            IN_EVENT_WRITE_DATA;
         }
      }
   }
   return 1;
}

See Also

Last modified 5 years ago Last modified on 05/17/19 15:34:44
Note: See TracWiki for help on using the wiki.