{"id":1655,"date":"2008-03-09T12:52:02","date_gmt":"2008-03-09T12:52:02","guid":{"rendered":"http:\/\/www.amibroker.org\/userkb\/2008\/03\/09\/button-header-collapseexpand\/"},"modified":"2008-03-21T13:12:33","modified_gmt":"2008-03-21T13:12:33","slug":"button-header-collapseexpand","status":"publish","type":"post","link":"http:\/\/www.amibroker.org\/editable_userkb\/2008\/03\/09\/button-header-collapseexpand\/","title":{"rendered":"Button Header (Collapse\/Expand)"},"content":{"rendered":"

Note: A number of variables and function names were changed to provide more consistent naming; please upgrade your code and Include file. I regret that such changes may happen rather often, however, the only alternative would be to complete all posts for this topic and publish them all at once. Since there is no guarantee that all code will ever be fully completed (most of my development work never stops), I think it is better to publish whatever is functional, as if this were a development blog. <\/p>\n

The purpose of the Button Header is to name button columns (this is needed to key static variables<\/a>) and provide a Collapse\/Expand function for Button Columns. Clicking on a Button Header will alternatively Collapse and Expand button columns. This allows you to quickly expose chart sections that were hidden by the Control Panel. A collapsed Button Column will look like this: <\/p>\n

\n\"clip_image002\"<\/a>\n<\/p>\n

Clicking on the Header Button will expand the column to look as show below: <\/p>\n

\n\"clip_image002[5]\"<\/a><\/p>\n

A 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>\n

The 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>ColExpanded<\/span>, <\/span>Colname<\/span>;\r    <\/span>RowNumber <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>))+<\/span>1<\/span>;\r    <\/span>kStaticVarSet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>, <\/span>RowNumber<\/span>);\r    <\/span>Trigger <\/span>= <\/span>GetMouseClick<\/span>( <\/span>ColNumber<\/span>, <\/span>RowNumber <\/span>);\r    if( <\/span>Trigger <\/span>) \r        {\r        <\/span>BackColor <\/span>= <\/span>backColor2<\/span>; \r        <\/span>ColExpanded <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>));\r        if( <\/span>ColExpanded <\/span>) <\/span>kStaticVarSet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>, <\/span>False<\/span>);\r        else <\/span>kStaticVarSet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>, <\/span>True<\/span>);\r        }\r    else <\/span>BackColor <\/span>= <\/span>backColor1<\/span>;\r    <\/span>ColExpanded <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>));\r    <\/span>kStaticVarSetText<\/span>(<\/span>"TextButton"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>Label<\/span>);\r    <\/span>kStaticVarSet<\/span>(<\/span>"TextColor"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>TextColor<\/span>);\r    <\/span>kStaticVarSet<\/span>(<\/span>"BackColor"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>backColor<\/span>);\r    }<\/span><\/pre>\n

In the above code, when the left Mouse button is clicked, a static variable named ColExpanded is toggled between True and False. All earlier button functions have been modified to only execute their internal code only if this variable is True. This way Buttons will only display if the variable ColExpanded it True. The listing below shows how the TriggerButton() was modified. This and the HeaderButton functions are located in the Include file at the end of this post; there is no need to copy them separately. <\/p>\n

<\/span>function <\/span>ButtonTrigger<\/span>( <\/span>Label<\/span>, <\/span>backColor1<\/span>, <\/span>BackColor2<\/span>, <\/span>TextColor<\/span>)\r    {\r    global <\/span>ColNumber<\/span>, <\/span>RowNumber<\/span>, <\/span>ColName<\/span>;\r    <\/span>ColExpanded <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>));\r    if( <\/span>ColExpanded <\/span>)\r        {\r        <\/span>ColName <\/span>= <\/span>VarGetText<\/span>(<\/span>"ColName"<\/span>);\r        <\/span>RowNumber <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>))+<\/span>1<\/span>;\r        <\/span>kStaticVarSet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>, <\/span>RowNumber<\/span>);\r        <\/span>Trigger <\/span>= <\/span>GetMouseClick<\/span>( <\/span>ColNumber<\/span>, <\/span>RowNumber <\/span>);\r        if( <\/span>Trigger <\/span>) <\/span>BackColor <\/span>= <\/span>backColor2<\/span>; else <\/span>BackColor <\/span>= <\/span>backColor1<\/span>;\r        <\/span>kStaticVarSetText<\/span>(<\/span>"TextButton"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>Label<\/span>);\r        <\/span>kStaticVarSet<\/span>(<\/span>"TextColor"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>TextColor<\/span>);\r        <\/span>kStaticVarSet<\/span>(<\/span>"BackColor"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>backColor<\/span>);\r        }\r    else <\/span>Trigger <\/span>= <\/span>0<\/span>;\r    return <\/span>Trigger<\/span>;\r    }  <\/span><\/pre>\n

The new ControlPanelInclude-003.afl Include file is listed below, it must be copied to your default Include folder for the above code to work.<\/p>\n

<\/span>\/\/ ControlPanelInclude-003.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>SName <\/span>)                     \r    { \r    <\/span>ChartID     <\/span>= <\/span>GetChartID<\/span>();\r    Var = <\/span>StaticVarGet<\/span>(<\/span>Sname<\/span>+<\/span>ChartID<\/span>);\r    return Var;\r    }\r\r<\/span>procedure kStaticVarSetText<\/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>StaticVarSetText<\/span>(<\/span>Sname<\/span>+<\/span>ChartID<\/span>, <\/span>Svalue<\/span>); \r    }\r\rfunction <\/span>kStaticVarGetText<\/span>( <\/span>SName <\/span>)                 \r    { \r    <\/span>ChartID <\/span>= <\/span>GetChartID<\/span>();\r    return <\/span>StaticVarGetText<\/span>(<\/span>Sname<\/span>+<\/span>ChartID<\/span>); \r    }\r\rfunction <\/span>NewColumn<\/span>()\r    {\r    <\/span>VarSet<\/span>(<\/span>"ColNumber"<\/span>, <\/span>0<\/span>);\r    }\r\rfunction <\/span>GetMouseClick<\/span>( <\/span>ColNumber<\/span>, <\/span>RowNumber <\/span>)\r    {\r    global <\/span>PanelYoffset<\/span>, <\/span>PanelXoffset<\/span>, <\/span>ButtonHeight<\/span>, <\/span>ButtonWidth<\/span>;\r    <\/span>LButtonDown <\/span>= <\/span>GetCursorMouseButtons<\/span>() == <\/span>9<\/span>;\r    <\/span>Click <\/span>= <\/span>0<\/span>;\r    if( <\/span>LButtonDown <\/span>)\r        {\r        <\/span>ULButtonX         <\/span>= <\/span>PanelXoffset <\/span>+ (<\/span>ColNumber<\/span>-<\/span>1<\/span>) * <\/span>ButtonWidth<\/span>;\r        <\/span>LRButtonX        <\/span>= <\/span>ULButtonX <\/span>+ <\/span>ButtonWidth<\/span>;\r        <\/span>ULButtonY         <\/span>= (<\/span>RowNumber <\/span>-<\/span>1<\/span>) * <\/span>ButtonHeight <\/span>+ <\/span>PanelYoffset<\/span>;\r        <\/span>LRButtonY        <\/span>= <\/span>ULButtonY <\/span>+ <\/span>ButtonHeight<\/span>;\r        <\/span>MouseCoord <\/span>= <\/span>Nz<\/span>(<\/span>StaticVarGet<\/span>(<\/span>"ClickCoordinates"<\/span>));\r        if( <\/span>MouseCoord <\/span>== <\/span>0 <\/span>AND <\/span>LButtonDown <\/span>)\r            {\r            <\/span>MousePx <\/span>= <\/span>GetCursorXPosition<\/span>( <\/span>1 <\/span>);\r            <\/span>MousePy <\/span>= <\/span>GetCursorYPosition<\/span>( <\/span>1 <\/span>);\r            if( <\/span>MousePx <\/span>> <\/span>ULButtonX <\/span>AND <\/span>MousePx <\/span>< <\/span>LRButtonX <\/span>AND <\/span>MousePy <\/span>> <\/span>ULButtonY <\/span>AND <\/span>MousePy <\/span>< <\/span>LRButtonY <\/span>)\r                {\r                <\/span>StaticVarSet<\/span>(<\/span>"ClickCoordinates"<\/span>,<\/span>ColNumber<\/span>*<\/span>100<\/span>+<\/span>RowNumber<\/span>);\r                <\/span>Click <\/span>= <\/span>1<\/span>;\r                }\r            }\r        }\r    return <\/span>Click<\/span>;\r    }\r\rfunction <\/span>ButtonColumnBegin<\/span>( <\/span>ColName <\/span>) \r    {\r    global <\/span>FontRatio<\/span>, <\/span>ColName<\/span>, <\/span>ColNumber<\/span>, <\/span>ButtonHeight<\/span>, <\/span>ButtonWidth<\/span>, <\/span>PanelXoffset<\/span>, <\/span>PanelYoffset<\/span>, <\/span>Colname<\/span>;\r    <\/span>ColNumber <\/span>= <\/span>VarGet<\/span>(<\/span>"ColNumber"<\/span>);\r    if( <\/span>IsEmpty<\/span>( <\/span>ColNumber <\/span>) ) \r        {\r        <\/span>VarSet<\/span>(<\/span>"ColNumber"<\/span>,<\/span>1<\/span>);\r        <\/span>StaticVarSet<\/span>(<\/span>"ClickCoordinates"<\/span>,<\/span>0<\/span>);\r        }\r    else <\/span>VarSet<\/span>(<\/span>"ColNumber"<\/span>, ++<\/span>ColNumber<\/span>);\r    <\/span>ColName <\/span>= <\/span>ColName<\/span>+<\/span>GetChartID<\/span>();\r    <\/span>kStaticVarSet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>, <\/span>0<\/span>);\r    <\/span>VarSetText<\/span>(<\/span>"ColName"<\/span>,<\/span>ColName<\/span>);\r    <\/span>GfxSetOverlayMode<\/span>( <\/span>0 <\/span>);\r    <\/span>GfxSelectFont<\/span>( <\/span>"Tahoma"<\/span>, <\/span>ButtonHeight<\/span>\/<\/span>FontRatio<\/span>, <\/span>800 <\/span>); \r    <\/span>GfxSelectPen<\/span>( <\/span>colorBlack <\/span>); \r    <\/span>GfxSetBkMode<\/span>( <\/span>1 <\/span>);\r    }\r\rfunction <\/span>ButtonText<\/span>( <\/span>TextButton<\/span>, <\/span>backColor<\/span>, <\/span>TextColor<\/span>)\r    {\r    global <\/span>ColNumber<\/span>, <\/span>RowNumber<\/span>, <\/span>Colname<\/span>;\r    <\/span>ColExpanded <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>));\r    if( <\/span>ColExpanded <\/span>)\r        {\r        <\/span>ColName <\/span>= <\/span>VarGetText<\/span>(<\/span>"ColName"<\/span>);\r        <\/span>RowNumber <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>))+<\/span>1<\/span>;\r        <\/span>kStaticVarSet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>, <\/span>RowNumber<\/span>);\r        <\/span>kStaticVarSetText<\/span>(<\/span>"TextButton"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>TextButton<\/span>);\r        <\/span>kStaticVarSet<\/span>(<\/span>"TextColor"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>TextColor<\/span>);\r        <\/span>kStaticVarSet<\/span>(<\/span>"BackColor"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>backColor<\/span>);\r        }\r    }\r\rfunction <\/span>ButtonTrigger<\/span>( <\/span>Label<\/span>, <\/span>backColor1<\/span>, <\/span>BackColor2<\/span>, <\/span>TextColor<\/span>)\r    {\r    global <\/span>ColNumber<\/span>, <\/span>RowNumber<\/span>, <\/span>ColName<\/span>;\r    <\/span>ColExpanded <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>));\r    if( <\/span>ColExpanded <\/span>)\r        {\r        <\/span>ColName <\/span>= <\/span>VarGetText<\/span>(<\/span>"ColName"<\/span>);\r        <\/span>RowNumber <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>))+<\/span>1<\/span>;\r        <\/span>kStaticVarSet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>, <\/span>RowNumber<\/span>);\r        <\/span>Trigger <\/span>= <\/span>GetMouseClick<\/span>( <\/span>ColNumber<\/span>, <\/span>RowNumber <\/span>);\r        if( <\/span>Trigger <\/span>) <\/span>BackColor <\/span>= <\/span>backColor2<\/span>; else <\/span>BackColor <\/span>= <\/span>backColor1<\/span>;\r        <\/span>kStaticVarSetText<\/span>(<\/span>"TextButton"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>Label<\/span>);\r        <\/span>kStaticVarSet<\/span>(<\/span>"TextColor"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>TextColor<\/span>);\r        <\/span>kStaticVarSet<\/span>(<\/span>"BackColor"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>backColor<\/span>);\r        }\r    else <\/span>Trigger <\/span>= <\/span>0<\/span>;\r    return <\/span>Trigger<\/span>;\r    }\r\rfunction <\/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>ColExpanded<\/span>, <\/span>Colname<\/span>;\r    <\/span>RowNumber <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>))+<\/span>1<\/span>;\r    <\/span>kStaticVarSet<\/span>(<\/span>"RowNumber"<\/span>+<\/span>ColName<\/span>, <\/span>RowNumber<\/span>);\r    <\/span>Trigger <\/span>= <\/span>GetMouseClick<\/span>( <\/span>ColNumber<\/span>, <\/span>RowNumber <\/span>);\r    if( <\/span>Trigger <\/span>) \r        {\r        <\/span>BackColor <\/span>= <\/span>backColor2<\/span>; \r        <\/span>ColExpanded <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>));\r        if( <\/span>ColExpanded <\/span>) <\/span>kStaticVarSet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>, <\/span>False<\/span>);\r        else <\/span>kStaticVarSet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>, <\/span>True<\/span>);\r        }\r    else <\/span>BackColor <\/span>= <\/span>backColor1<\/span>;\r    <\/span>ColExpanded <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>ColName<\/span>+<\/span>"ColExpanded"<\/span>));\r    <\/span>kStaticVarSetText<\/span>(<\/span>"TextButton"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>Label<\/span>);\r    <\/span>kStaticVarSet<\/span>(<\/span>"TextColor"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>TextColor<\/span>);\r    <\/span>kStaticVarSet<\/span>(<\/span>"BackColor"<\/span>+<\/span>ColName<\/span>+<\/span>RowNumber<\/span>, <\/span>backColor<\/span>);\r    }\r\rfunction <\/span>ButtonColumnEnd<\/span>()\r    {\r    global <\/span>ButtonHeight<\/span>, <\/span>ButtonWidth<\/span>, <\/span>PanelYoffset<\/span>, <\/span>PanelXoffset<\/span>, <\/span>ColNumber<\/span>, <\/span>RowNumber<\/span>, <\/span>ColName<\/span>;\r    <\/span>ChartIDStr     <\/span>= <\/span>NumToStr<\/span>(<\/span>GetChartID<\/span>(),<\/span>1.0<\/span>,<\/span>False<\/span>);\r    <\/span>ULButtonX         <\/span>= <\/span>PanelXoffset <\/span>+ (<\/span>ColNumber<\/span>-<\/span>1<\/span>) * <\/span>ButtonWidth<\/span>;\r    <\/span>LRButtonX        <\/span>= <\/span>ULButtonX <\/span>+ <\/span>ButtonWidth<\/span>;\r    for( <\/span>Row <\/span>= <\/span>1<\/span>; <\/span>Row <\/span><= <\/span>RowNumber<\/span>; <\/span>Row<\/span>++ ) \r        {\r        <\/span>ULButtonY         <\/span>= (<\/span>Row<\/span>-<\/span>1<\/span>) * <\/span>ButtonHeight <\/span>+ <\/span>PanelYoffset<\/span>;\r        <\/span>LRButtonY        <\/span>= <\/span>ULButtonY <\/span>+ <\/span>ButtonHeight<\/span>;\r        <\/span>Label     <\/span>= <\/span>kStaticVarGetText<\/span>(<\/span>"TextButton"<\/span>+<\/span>ColName<\/span>+<\/span>Row<\/span>);\r        <\/span>TextColor     <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>"TextColor"<\/span>+<\/span>ColName<\/span>+<\/span>Row<\/span>));\r        <\/span>BackColor     <\/span>= <\/span>Nz<\/span>(<\/span>kStaticVarGet<\/span>(<\/span>"BackColor"<\/span>+<\/span>ColName<\/span>+<\/span>Row<\/span>));\r        <\/span>GfxSelectSolidBrush<\/span>( <\/span>BackColor<\/span>);\r        <\/span>GfxRectangle<\/span>( <\/span>ULButtonX<\/span>, <\/span>ULButtonY<\/span>, <\/span>LRButtonX<\/span>, <\/span>LRButtonY <\/span>); \r        <\/span>GfxSetBkColor<\/span>( <\/span>BackColor<\/span>);\r        <\/span>GfxSetTextColor<\/span>( <\/span>TextColor <\/span>);\r        <\/span>GfxDrawText<\/span>( <\/span>Label<\/span>, <\/span>ULButtonX<\/span>, <\/span>ULButtonY<\/span>, <\/span>LRButtonX<\/span>, <\/span>LRButtonY<\/span>, <\/span>32 <\/span>| <\/span>1 <\/span>| <\/span>4<\/span>);\r        }\r    }<\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"

Note: A number of variables and function names were changed to provide more consistent naming; please upgrade your code and Include file. I regret that such changes may happen rather often, however, the only alternative would be to complete all posts for this topic and publish them all at once. Since there is no guarantee […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[134],"tags":[],"_links":{"self":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/posts\/1655"}],"collection":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/comments?post=1655"}],"version-history":[{"count":0,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/posts\/1655\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/media?parent=1655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/categories?post=1655"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/tags?post=1655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}