Hi:
I'm trying to change the value of a variable ("Contracts") by left button clicking on the text displayed on the chart, but I can't seem to get it to work with the following code. Does anyone have a suggestion?
var Contracts = 1;
function ContractSwitch1(nButtonPressed)
{
Contracts = 1;
ContractsButton1();
}
function ContractsButton1()
{
if (Contracts == 1)
{
drawTextAbsolute(14, 14, " " + 1 + "@URL=EFS:ContractSwitch1" + " ", Color.black, Color.lime, Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.LEFT | Text.FRAME | Text.ONTOP | Text.BOLD, null, 11, "CB1");
drawTextAbsolute(17, 14, " " + 2 + "@URL=EFS:ContractSwitch2" + " ", Color.black, Color.white, Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.LEFT | Text.FRAME | Text.ONTOP | Text.BOLD, null, 11, "CB2");
}
}
function ContractSwitch2(nButtonPressed)
{
Contracts = 2;
ContractsButton2();
}
function ContractsButton2()
{
if (Contracts == 2)
{
drawTextAbsolute(17, 14, " " + 2 + "@URL=EFS:ContractSwitch2" + " ", Color.black, Color.lime, Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.LEFT | Text.FRAME | Text.ONTOP | Text.BOLD, null, 11, "CB2");
drawTextAbsolute(14, 14, " " + 1 + "@URL=EFS:ContractSwitch1" + " ", Color.black, Color.white, Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.LEFT | Text.FRAME | Text.ONTOP | Text.BOLD, null, 11, "CB1");
}
}
function main()
{
ContractsButton1();
ContractsButton2();
}
I'm trying to change the value of a variable ("Contracts") by left button clicking on the text displayed on the chart, but I can't seem to get it to work with the following code. Does anyone have a suggestion?
var Contracts = 1;
function ContractSwitch1(nButtonPressed)
{
Contracts = 1;
ContractsButton1();
}
function ContractsButton1()
{
if (Contracts == 1)
{
drawTextAbsolute(14, 14, " " + 1 + "@URL=EFS:ContractSwitch1" + " ", Color.black, Color.lime, Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.LEFT | Text.FRAME | Text.ONTOP | Text.BOLD, null, 11, "CB1");
drawTextAbsolute(17, 14, " " + 2 + "@URL=EFS:ContractSwitch2" + " ", Color.black, Color.white, Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.LEFT | Text.FRAME | Text.ONTOP | Text.BOLD, null, 11, "CB2");
}
}
function ContractSwitch2(nButtonPressed)
{
Contracts = 2;
ContractsButton2();
}
function ContractsButton2()
{
if (Contracts == 2)
{
drawTextAbsolute(17, 14, " " + 2 + "@URL=EFS:ContractSwitch2" + " ", Color.black, Color.lime, Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.LEFT | Text.FRAME | Text.ONTOP | Text.BOLD, null, 11, "CB2");
drawTextAbsolute(14, 14, " " + 1 + "@URL=EFS:ContractSwitch1" + " ", Color.black, Color.white, Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.LEFT | Text.FRAME | Text.ONTOP | Text.BOLD, null, 11, "CB1");
}
}
function main()
{
ContractsButton1();
ContractsButton2();
}
Comment