Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How would you use a javascript function to format all buttons

Avatar

Avatar
Validate 1
Level 2
DiveMasterTx
Level 2

Likes

2 likes

Total Posts

16 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
Affirm 1
View profile

Avatar
Validate 1
Level 2
DiveMasterTx
Level 2

Likes

2 likes

Total Posts

16 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
Affirm 1
View profile
DiveMasterTx
Level 2

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)

Avatar

Avatar
Validate 1
Level 2
DiveMasterTx
Level 2

Likes

2 likes

Total Posts

16 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
Affirm 1
View profile

Avatar
Validate 1
Level 2
DiveMasterTx
Level 2

Likes

2 likes

Total Posts

16 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
Affirm 1
View profile
DiveMasterTx
Level 2

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)