Page 1 of 1

Change dynamic stamp text after placement

Posted: Fri Feb 28, 2020 11:46 am
by lidds
I have created a dynamic stamp that has 2 text fields on the stamp and added the below JS to one of the text fields.

Code: Select all

var oDlg = {
    strName: "", initialize: function(dialog) {
        dialog.load({"frmData":this.strLine1});
    },
    commit: function(dialog) {
        var data = dialog.store(); 
        this.strLine1 = data[ "txtLine1"]; 
        this.strLine2 = data[ "txtLine2"]; 
    },
    description: {
        name: "Enter Symbol Data", elements: [ {
            type: "view", elements: [
                { name: "Enter Line1:", type: "static_text", }, 
                { item_id: "txtLine1", type: "edit_text", char_width: 50 },
                { name: "Enter Line2:", type: "static_text", },
                { item_id: "txtLine2", type: "edit_text", char_width: 50 },
                { type: "ok_cancel", },
            ]
        },]
    }
};  

// Dialog Activation 
if(event.source.forReal && (this.selectedAnnots[0].AP == "qC0lj9Fnk5MVjEK7Z2jDr1"))
{
if( "ok" == app.execDialog(oDlg)) { 
    getField("txtLine1").value = oDlg.strLine1; 
    getField("txtLine2").value = oDlg.strLine2; 
}
}
The JS works correctly and when placing the stamp a dialog box appears asking to enter line 1 and line 2 text and adds this to the stamp. Great!!

My question is if there is a way to write some JS that the user can select the already placed dynamic stamp and run the JS to display the same dialog with the text values that were previously entered in the dialog. Then the user could edit the values and click OK on the dialog form and this would replace the text on the text fields on the stamp.

I was thinking something like this on the OK event to change the text, but it does not work

Code: Select all

// Dialog Activation 
if(this.selectedAnnots[0].AP == "qC0lj9Fnk5MVjEK7Z2jDr1")
{
if( "ok" == app.execDialog(oDlg)) { 
    this.selectedAnnots[0].getField("txtLine1").value = oDlg.strLine1; 
    this.selectedAnnots[0].getField("txtLine2").value = oDlg.strLine2; 
}
}
Thanks

Simon

Re: Change dynamic stamp text after placement

Posted: Fri Feb 28, 2020 12:01 pm
by Will - Tracker Supp
Hi Simon,

Thanks for the post - This isn't possible with JavaScript because once a dynamic stamp is placed it becomes a static stamp; essentially just an image.

For text-based stamps, you should be able to flatten the stamp and it will then be recognized as text. With that you may be able customize your app to offer this. However, I would suggest that this isn't trivial, even if it's possible.

Thanks,