How would you use a javascript function to format all buttons

DiveMasterTx 10-01-2019

How would you go about using a function to change button format in one place?  I think the function needs to identify which button called it instead of using "this"?

Currently I put code in each buttons events see below for a sample.

LP.Pg3.PgBody.rowSFrmLP.sfrmBtn.Remove::mouseEnter - (JavaScript, client)

// set caption to red and underlined

this.caption.font.underline = "1";

this.caption.font.fill.color.value = "255,0,0";

 

LP.Pg3.PgBody.rowSFrmLP.sfrmBtn.Remove::mouseExit - (JavaScript, client)

// set caption to black and no underline

this.caption.font.underline = "0";

this.caption.font.fill.color.value = "0,0,0";

I would like to do something like the following code assigned each button to make it easier to maintain and I could simply change the function to change all the buttons formatting at once.

function fMouseIn()
{
// set caption to red and underlined
this.caption.font.underline = "1";
this.caption.font.fill.color.value = "255,0,0";
}

function fMouseOut()
{
// set caption to black and no underline
this.caption.font.underline = "0";
this.caption.font.fill.color.value = "0,0,0";
}

LP.Pg3.PgBody.rowSFrmLP.sfrmBtn.Remove::mouseEnter - (JavaScript, client)

sFrm.MouseIn();

 

LP.Pg3.PgBody.rowSFrmLP.sfrmBtn.Remove::mouseExit - (JavaScript, client)

sFrm.MouseOut();

Accepted Solutions (1)

Accepted Solutions (1)

DiveMasterTx 10-01-2019

Now I get to play and see if I can make a single function for Instance manager buttons

What let me solve this was Is there a way to know which subform button was clicked?  Answered by radzmar

function fMouseIn()
{
// xfa.host.messageBox("The button '" + xfa.context.name + "' (" + xfa.context.somExpression + ") event triggerred.");
// set caption to red and underlined
var MyButton = xfa.context;
MyButton.caption.font.underline = "1";
MyButton.caption.font.fill.color.value = "255,0,0";
}

function fMouseOut()
{
// xfa.host.messageBox("The button '" + xfa.context.name + "' (" + xfa.context.somExpression + ") event triggerred.");
// set caption to black and no underline
var MyButton = xfa.context;
MyButton.caption.font.underline = "0";
MyButton.caption.font.fill.color.value = "0,0,0";

Answers (0)