<\/a><\/p>\nTo display the buttons horizontally lengthens the code a little because the code is optimized for vertical button columns. Here is the code that places the above button array on your chart:<\/p>\n
<\/span>#include <ControlPanelInclude-001.afl>\r\r<\/span>global <\/span>ColNumber<\/span>;\r<\/span>RequestTimedRefresh<\/span>(<\/span>1<\/span>);\r<\/span>CellHeight <\/span>= <\/span>Param<\/span>(<\/span>"Cell Height"<\/span>,<\/span>20<\/span>,<\/span>5<\/span>,<\/span>200<\/span>,<\/span>1<\/span>); \r<\/span>CellWidth <\/span>= <\/span>Param<\/span>(<\/span>"Cell Width"<\/span>,<\/span>120<\/span>,<\/span>5<\/span>,<\/span>200<\/span>,<\/span>1<\/span>); \r<\/span>PanelYoffset <\/span>= <\/span>Param<\/span>(<\/span>"Cell Row Offset (px)"<\/span>,<\/span>10<\/span>,<\/span>0<\/span>,<\/span>Status<\/span>(<\/span>"pxheight"<\/span>),<\/span>1<\/span>); \r<\/span>PanelXoffset <\/span>= <\/span>Param<\/span>(<\/span>"Cell Column Offset (px)"<\/span>,<\/span>10<\/span>,<\/span>0<\/span>,<\/span>Status<\/span>(<\/span>"pxwidth"<\/span>),<\/span>1<\/span>); \r<\/span>FontRatio <\/span>= <\/span>Param<\/span>(<\/span>"Font: CellHeight ratio"<\/span>,<\/span>2<\/span>,<\/span>1<\/span>,<\/span>20<\/span>,<\/span>0.1<\/span>);\r\r<\/span>Column_Begin<\/span>( <\/span>"1" <\/span>);\r<\/span>TextCell<\/span>( <\/span>"AUTO-TRADING"<\/span>, <\/span>colorRed<\/span>, <\/span>colorBlack<\/span>);\r<\/span>Column_End<\/span>( );\r\r<\/span>Column_Begin<\/span>( <\/span>"2" <\/span>);\r<\/span>Reset <\/span>= <\/span>TriggerCell<\/span>( <\/span>"START SESSION"<\/span>, <\/span>colorBrightGreen<\/span>, <\/span>colorRed<\/span>, <\/span>colorBlack<\/span>);\r<\/span>Column_End<\/span>( );\r\r<\/span>Column_Begin<\/span>( <\/span>"3" <\/span>);\r<\/span>CancelAll <\/span>= <\/span>TriggerCell<\/span>( <\/span>"CANCEL ALL"<\/span>, <\/span>colorBrightGreen<\/span>, <\/span>colorRed<\/span>, <\/span>colorBlack<\/span>);\r<\/span>Column_End<\/span>( );\r\r<\/span>Column_Begin<\/span>( <\/span>"4" <\/span>);\r<\/span>CloseAll <\/span>= <\/span>TriggerCell<\/span>( <\/span>"CLOSE ALL"<\/span>, <\/span>colorBrightGreen<\/span>, <\/span>colorRed<\/span>, <\/span>colorBlack<\/span>);\r<\/span>Column_End<\/span>( );\r\r<\/span>Column_Begin<\/span>( <\/span>"5"<\/span>);\r<\/span>EndSession <\/span>= <\/span>TriggerCell<\/span>( <\/span>"END SESSION"<\/span>, <\/span>colorBrightGreen<\/span>, <\/span>colorRed<\/span>, <\/span>colorBlack<\/span>);\r<\/span>Column_End<\/span>( );\r\r<\/span>ClickCoordinates <\/span>= <\/span>Nz<\/span>(<\/span>StaticVarGet<\/span>(<\/span>"ClickCoordinates"<\/span>));\rswitch( <\/span>ClickCoordinates <\/span>)\r {\r case <\/span>201<\/span>:\r <\/span>Say<\/span>( <\/span>"201"<\/span>);\r break;\r case <\/span>301<\/span>:\r <\/span>Say<\/span>( <\/span>"301"<\/span>);\r break;\r case <\/span>401<\/span>:\r <\/span>Say<\/span>( <\/span>"401"<\/span>);\r break;\r case <\/span>501<\/span>:\r <\/span>Say<\/span>( <\/span>"501"<\/span>);\r break;\r }\r\r<\/span>Plot<\/span>(<\/span>C<\/span>,<\/span>""<\/span>,<\/span>1<\/span>,<\/span>128<\/span>);\r\r<\/span>Title <\/span>= <\/span>"CLICK COORDINATES: "<\/span>+<\/span>ClickCoordinates<\/span>;<\/span><\/pre>\nThe Trigger function returns a trigger, i.e., a True state that lasts only for the current refresh and that returns False at the next pass through the code. A Triggername is assigned to each button and is used to key the static variables. Backcolor1 is the normal color of the button. Backcolor2 is the color the button takes on when it is clicked on; this gives a visual confirmation that the click was registered. If a button is clicked on, the button coordinates (vertical position, horizontal position) are returned in compressed for as ColNumber*100+RowNumber.<\/p>\n
Trigger action can be invoked in two ways: by checking the value returned by the trigger functions, and by processing the click-coordinates in a Switch() statement. Each method may have advantages depending on the application.<\/p>\n
Below a listing of the revised Include file, please copy to your default include folder. <\/p>\n
<\/span>\/\/ ControlPanelInclude-001.afl\r<\/span>procedure kStaticVarSet<\/span>( <\/span>SName<\/span>, <\/span>SValue <\/span>) \r {\r <\/span>ChartID <\/span>= <\/span>GetChartID<\/span>();\r <\/span>InIndicator <\/span>= <\/span>Status<\/span>(<\/span>"Action"<\/span>) == <\/span>1<\/span>;\r if( <\/span>InIndicator <\/span>) <\/span>StaticVarSet<\/span>(<\/span>Sname<\/span>+<\/span>ChartID<\/span>, <\/span>Svalue<\/span>); \r }\r\rfunction <\/span>kStaticVarGet<\/span>( <\/span>