MessagePanelInclude.afl---- Help Need

trillian

Active Member
#1
Hi friends,

I am using Amibroker quite few months ago. I am not good @ coding afl. I am getting a syntax error in the following afl. Some =one please findout where might be the error (Its showing syntax error in kStaticVarSet) . It will be helpful for me. Just correct the afl and post here friends.

procedure kStaticVarSet( SName, SValue )
{
ChartID = GetChartID();
InIndicator = Status("Action") == 1;
if( InIndicator ) StaticVarSet(Sname+ChartID, Svalue);
}
function kStaticVarGet( SName )
{
ChartID = GetChartID();
Var = StaticVarGet(Sname+ChartID);
return Var;
}
procedure kStaticVarSetText( SName, SValue )
{
ChartID = GetChartID();
InIndicator = Status("Action") == 1;
if( InIndicator ) StaticVarSetText(Sname+ChartID, Svalue);
}
function kStaticVarGetText( SName )
{
ChartID = GetChartID();
return StaticVarGetText(Sname+ChartID);
}
function MsgCol_Begin( ColName, CellHeight, CellWidth, PanelXoffset, PanelYoffset )
{
global FontRatio, ColName, ColNumber;
ColNumber = VarGet("ColNumber");
if( IsEmpty( ColNumber ) ) VarSet("ColNumber",1);
else VarSet("ColNumber", ++ColNumber);
ColName = ColName+GetChartID();
GfxSetOverlayMode( 0 );
GfxSelectFont( "Tahoma", CellHeight/FontRatio, 800 );
GfxSelectPen( colorBlack );
GfxSetBkMode( 1 );
kStaticVarSet("PanelItemNum"+ColName, 0);
VarSetText("ColName",ColName);
return ColNumber;
}

function Column_End( )
{
global CellHeight, CellWidth, PanelYoffset, PanelXoffset, ColNumber, RowNumber;
RowNumber=1;//added by Brian to get it working
ChartIDStr = NumToStr(GetChartID(),1.0,False);
ColName = VarGetText("ColName");
ULCellX = PanelXoffset + (ColNumber-1) * CellWidth;
LRCellX = ULCellX + CellWidth;
for( Row = 1; Row <= RowNumber; Row++ )
{
ULCellY = (Row-1) * CellHeight + PanelYoffset;
LRCellY = ULCellY + CellHeight;
TextCell = kStaticVarGetText("TextCell"+ColName+Row);
TextColor = Nz(kStaticVarGet("TextColor"+ColName+Row));
BackColor = Nz(kStaticVarGet("BackColor"+ColName+Row));
GfxSelectSolidBrush( BackColor);
GfxRectangle( ULCellX, ULCellY, LRCellX, LRCellY );
GfxSetBkColor( BackColor);
GfxSetTextColor( TextColor );
GfxDrawText( TextCell, ULCellX, ULCellY, LRCellX, LRCellY, 32 | 1 | 4);
}
}





function MsgCol_End( )
{
global CellHeight, CellWidth, PanelYoffset, PanelXoffset, ColNumber, PanelItemNum;
ChartIDStr = NumToStr(GetChartID(),1.0,False);
ColName = VarGetText("ColName");
ULCellX = PanelXoffset + (ColNumber-1) * CellWidth;
LRCellX = ULCellX + CellWidth;
for( Row = 1; Row <= PanelItemNum; Row++ )
{
ULCellY = (Row-1) * CellHeight + PanelYoffset;
LRCellY = ULCellY + CellHeight;
TextCell = kStaticVarGetText("TextCell"+ColName+Row);
TextColor = Nz(kStaticVarGet("TextColor"+ColName+Row));
BackColor = Nz(kStaticVarGet("BackColor"+ColName+Row));
if( Row==1) TextCell = StrReplace( TextCell, ChartIDStr, "");
GfxSelectSolidBrush( BackColor);
GfxRectangle( ULCellX, ULCellY, LRCellX, LRCellY );
GfxSetBkColor( BackColor);
GfxSetTextColor( TextColor );
GfxDrawText( TextCell, ULCellX, ULCellY, LRCellX, LRCellY, 32 | 1 | 4);
}
}
function TextCell( TextCell, backColor, TextColor)
{
global InitializePanels, PanelVisible;
ColName = VarGetText("ColName");
PanelItemNum = Nz(kStaticVarGet("PanelItemNum"+ColName))+1;
kStaticVarSet("PanelItemNum"+ColName, PanelItemNum);
kStaticVarSet("CellState"+ColName+PanelItemNum, False);
Label = StrExtract(TextCell,0);
kStaticVarSetText("TextCell"+ColName+PanelItemNum, Label);
kStaticVarSet("TextColor"+ColName+PanelItemNum, TextColor);
kStaticVarSet("BackColor"+ColName+PanelItemNum, backColor);
}
function Newpanel()
{
VarSet("ColNumber", 0);
}

function NewColumn()
{
VarSet("ColNumber", 0);
}

function CheckMouseClick( ColNumber, RowNumber )
{
global PanelYoffset, PanelXoffset, CellHeight, CellWidth;
LButtonDown = GetCursorMouseButtons() == 9;
Click = 0;
if( LButtonDown )
{
ULCellX = PanelXoffset + (ColNumber-1) * CellWidth;
LRCellX = ULCellX + CellWidth;
ULCellY = (RowNumber -1) * CellHeight + PanelYoffset;
LRCellY = ULCellY + CellHeight;
MouseCoord = Nz(StaticVarGet("ClickCoordinates"));
if( MouseCoord == 0 AND LButtonDown )
{
MousePx = GetCursorXPosition( 1 );
MousePy = GetCursorYPosition( 1 );
if( MousePx > ULCellX AND MousePx < LRCellX AND MousePy > ULCellY AND MousePy < LRCellY )
{
StaticVarSet("ClickCoordinates",ColNumber*100+RowNumber);
Click = 1;
}
}
}
return Click;
}

function TriggerCell( Label, backColor1, BackColor2, TextColor)
{
global ColNumber, RowNumber;;
ColName = VarGetText("ColName");
RowNumber = Nz(kStaticVarGet("RowNumber"+ColName))+1;
kStaticVarSet("RowNumber"+ColName, RowNumber);
Trigger = CheckMouseClick( ColNumber, RowNumber );
if( Trigger ) BackColor = backColor2; else BackColor = backColor1;
kStaticVarSetText("TextCell"+ColName+RowNumber, Label);
kStaticVarSet("TextColor"+ColName+RowNumber, TextColor);
kStaticVarSet("BackColor"+ColName+RowNumber, backColor);
return Trigger;
}

function Column_Begin( ColName )
{
global FontRatio, ColName, ColNumber, CellHeight, CellWidth, PanelXoffset, PanelYoffset;
ColNumber = VarGet("ColNumber");
if( IsEmpty( ColNumber ) )
{
VarSet("ColNumber",1);
StaticVarSet("ClickCoordinates",0);
}
else VarSet("ColNumber", ++ColNumber);
ColName = ColName+GetChartID();
GfxSetOverlayMode( 0 );
GfxSelectFont( "Tahoma", CellHeight/FontRatio, 800 );
GfxSelectPen( colorBlack );
GfxSetBkMode( 1 );
kStaticVarSet("RowNumber"+ColName, 0);
VarSetText("ColName",ColName);
return ColNumber;
}

Thanks,
 
#3
Hi friends,

I am using Amibroker quite few months ago. I am not good @ coding afl. I am getting a syntax error in the following afl. Some =one please findout where might be the error (Its showing syntax error in kStaticVarSet) . It will be helpful for me. Just correct the afl and post here friends.




Thanks,
Hello,

Just change this line :
StaticVarSet("ClickCoordinates",ColNumber*100+RowN umber);

to :
StaticVarSet("ClickCoordinates",ColNumber*100+RowNumber);

Best regards,

AmiBroker-India
 

casoni

Well-Known Member
#4
Hello,
i think you posted part formula [ include portion],
here's the full formula ,looks nice but have to work on it ,
 
Last edited:

casoni

Well-Known Member
#5
Hello,
i think you posted part formula [ include portion],
here's the full formula ,looks nice but have to work on it ,
*forgot to upload image *
 
Last edited:

Similar threads