Function Options(*DIRECT) begin_com role(*EXTENDS #LRNG_FORM) * =============================================================== * LREX0093 : Signature - RDMLX Example * =============================================================== * This example allows the user to enter a signature over a background image and stores the signature as a separate image. . Define Field(#Value) Type(*STRING) Define Field(#Counter) Type(*INT) Define Field(#LastEntry) Type(*int) Define Field(#LF) Type(*char) Length(1) Desc('Linefeed Character') Define Field(#uMessage) Type(*string) Length(1000) Define Field(#uPanelID) Type(*char) Length(32) Define Field(#uDeviceID) Type(*char) Length(32) Define Field(#uStatus) Type(*BOOLEAN) define_com class(#prim_alph) name(#uImageFile) * The LRUDEMO component supplies utility methods to the LongRange Demo system and Example Formviews Define_Com Class(#lrudemo) Name(#DemoUtilities) Scope(*Application) Mthroutine Name(HandleRequest) Options(*REDEFINE) * ----------------------------------------- * Handle currently requested action * ----------------------------------------- * Always set the USING Element to /Form.Fields at the start #Com_Owner.Using Element('/Form.Fields') * Get the platform dependent Linefeed character #LF := #COM_OWNER.LineFeed * Always Get Image Path #COM_OWNER.Get_ClientGUID Clientguid(#uDeviceID) #uImageFile := *PART_DIR_EXECUTE + 'LREX0093_Signature_Image_' + #uDeviceID + '.png' * Always attempt to save the Signature, IN CASE IT HAS CHANGED #Com_Owner.uSave_Signature * Main Case Statement Case Of_Field(#COM_OWNER.RequestACTION) When (= SHOWPROG) #COM_OWNER.IsNewForm := False #COM_OWNER.Set_Label Name('/Form.Popover') Text('See Visual LANSA reusable part ' + #Com_Owner.Name) Color(Blue) #Com_Owner.Set_Form Show_Popover(TRUE) When (= SUBMIT) #COM_OWNER.IsNewForm := False * Does not do anything except ensure that the server side runs again and saves the image Otherwise /* Default */ Endcase * -------------------------------------------------------------- * Format out the 'static' parts of the form view to be displayed * -------------------------------------------------------------- * Form #COM_OWNER.Set_Form Title('Signatures') #COM_OWNER.Set_Form Grid_Col_N(1) Grid_Col_Width(Fill) * Set up the Image * It always has a 'background image' * The background image is in the resource folder object which optimizes using it * If an annotation image exists on the IFS (#uImageFile) it will be overlaid #Com_Owner.Set_Image Name(IMAGE_1_ELEMENT) Allowchange(False) Allowexpand(True) Layout_Row(1) Layout_Col(1) Blankimageresource('PleaseSignHere2.PNG' ) Annotate_Showbutton(False) Annotate_Showcolrpkr(False) Annotate_Inplaceedit(True) Annotate_Strokewidth(5) Annotate_Strokecolor(Red) Annotate_Mergewthimg(False) Annotate_Image(#uImageFile) NewImage_Format(PNG) * save button #Com_Owner.Set_Button Layout_Row(2) Layout_Col(1) Onclick(SUBMIT) Text('Save Signature') Endroutine mthroutine uSave_Signature * This routine has to occur every cycle (every time control returns to the server), even if the user does not press the save button or the submit command, because the client side will not send the image down to the server if it is unchanged from what was received from the server. * Annotate_Mergewthimg (Annotate_Merge_with_Image) = False in this example. So any annotations are returned in .Annotation.Image. * Has an annotation image been added to the Image, or modified, this cycle? #uStatus := #Com_owner.CheckProperty( '/Form.Fields.IMAGE_1_ELEMENT.Annotation.Image' ) If (#uStatus) * There is an annotation - save it as a separate image #Com_Owner.Save_Annotation Name(IMAGE_1_ELEMENT) Filename(#uImageFile) Endif endroutine End_Com