<\/a><\/p>\nA few variables are displayed in the Title to facilitate debugging. The following listing shows the test code used to display the above Button Column. Note again that there are two ways to process button clicks: using the values returned by the button functions, or using the Switch() statement.<\/p>\n
<\/span>#include <ControlPanelInclude-003.afl>\r\r<\/span>global <\/span>ColNumber<\/span>;\r<\/span>RequestTimedRefresh<\/span>(<\/span>1<\/span>);\r<\/span>ButtonHeight <\/span>= <\/span>Param<\/span>(<\/span>"Button Height"<\/span>,<\/span>20<\/span>,<\/span>5<\/span>,<\/span>200<\/span>,<\/span>1<\/span>); \r<\/span>ButtonWidth <\/span>= <\/span>Param<\/span>(<\/span>"Button Width"<\/span>,<\/span>120<\/span>,<\/span>5<\/span>,<\/span>200<\/span>,<\/span>1<\/span>); \r<\/span>PanelYoffset <\/span>= <\/span>Param<\/span>(<\/span>"Button 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>"Button 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: ButtonHeight ratio"<\/span>,<\/span>2<\/span>,<\/span>1<\/span>,<\/span>20<\/span>,<\/span>0.1<\/span>);\r\r<\/span>ButtonColumnBegin<\/span>( <\/span>"1" <\/span>);\r<\/span>ButtonHeader<\/span>( <\/span>"COLUMN HEADER1"<\/span>, <\/span>colorBlue<\/span>, <\/span>colorLightBlue<\/span>,<\/span>colorWhite<\/span>);\r<\/span>ButtonText<\/span>( <\/span>"AUTO-TRADING ON"<\/span>, <\/span>colorBlue<\/span>, <\/span>colorWhite<\/span>);\r<\/span>Reset <\/span>= <\/span>ButtonTrigger<\/span>( <\/span>"START SESSION"<\/span>, <\/span>colorBrightGreen<\/span>, <\/span>colorRed<\/span>, <\/span>colorBlack<\/span>);\r<\/span>CancelAll <\/span>= <\/span>ButtonTrigger<\/span>( <\/span>"CANCEL ALL"<\/span>, <\/span>colorBrightGreen<\/span>, <\/span>colorRed<\/span>, <\/span>colorBlack<\/span>);\r<\/span>CloseAll <\/span>= <\/span>ButtonTrigger<\/span>( <\/span>"CLOSE ALL"<\/span>, <\/span>colorBrightGreen<\/span>, <\/span>colorRed<\/span>, <\/span>colorBlack<\/span>);\r<\/span>EndSession <\/span>= <\/span>ButtonTrigger<\/span>( <\/span>"END SESSION"<\/span>, <\/span>colorBrightGreen<\/span>, <\/span>colorRed<\/span>, <\/span>colorBlack<\/span>);\r<\/span>ButtonColumnEnd<\/span>( );\r\r<\/span>ClickCoordinates <\/span>= <\/span>Nz<\/span>(<\/span>StaticVarGet<\/span>(<\/span>"ClickCoordinates"<\/span>));\rswitch( <\/span>ClickCoordinates <\/span>)\r {\r case <\/span>101<\/span>:\r <\/span>Say<\/span>( <\/span>"1 1"<\/span>);\r break;\r case <\/span>102<\/span>:\r <\/span>Say<\/span>( <\/span>"1 2"<\/span>);\r break;\r case <\/span>103<\/span>:\r <\/span>Say<\/span>( <\/span>"1 3"<\/span>);\r break;\r case <\/span>104<\/span>:\r <\/span>Say<\/span>( <\/span>"1 4"<\/span>);\r break;\r case <\/span>105<\/span>:\r <\/span>Say<\/span>( <\/span>"1 5"<\/span>);\r break;\r case <\/span>106<\/span>:\r <\/span>Say<\/span>( <\/span>"1 6"<\/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>"\\n"<\/span>+\r<\/span>" Click Coordinates: "<\/span>+<\/span>ClickCoordinates<\/span>+<\/span>"\\n"<\/span>+\r<\/span>"Column Expanded Var: "<\/span>+<\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>));<\/span><\/pre>\nThe ButtonHeader() is similar to the ButtonText() function but has a Collapse\/Expand variable added. Here is the code for the new ButtonHeader() function: <\/p>\n
<\/span>function <\/span>ButtonHeader<\/span>( <\/span>Label<\/span>, <\/span>backColor1<\/span>, <\/span>BackColor2<\/span>, <\/span>TextColor<\/span>)\r {\r global <\/span>ColNumber<\/span>, <\/span>RowNumber<\/span>, <\/span>