February 12, 2008 13:20
THIS IS A BETA VERSION OF THE SOFTWARE. EXPECT BUGS !!!
Backup your data files and entire AmiBroker folder
first!
INSTALLATION INSTRUCTIONS
IMPORTANT: This archive is update-only. You have to install full version 5.00 first.
Just run the installer and follow the instructions.
Then run AmiBroker. You should see "AmiBroker 5.05.1 beta" written in the About box.
See CHANGE LOG below for detailed list of changes.
CHANGE LOG
CHANGES FOR VERSION 5.05.1 (as compared to 5.05.0)
CHANGES FOR VERSION 5.05.0 (as compared to 5.04.2)
/////////////////////////////////////////////////
// Low-level graphic + Interactive GUI control sample
// This example shows:
// 1. how to draw "buttons"
// 2. how to handle mouse clicks
// 3. how to implement event call-backs
///////////////////////////////////////////////////
Version( 5.04 ); //
requires 5.04 or higher
////////////////////////////////////////////////////
// Part 1: DRAWING TABLE OF BUTTONS
//////////////////////////////////////////////////
GfxSetOverlayMode( 2 );
// formatted text output sample via low-level gfx
functions
CellHeight = 20;
CellWidth = 100;
GfxSelectFont( "Tahoma",
CellHeight/2 );
GfxSetBkMode( 1 );
function PrintInCell(
string, row, Col )
{
GfxDrawText( string,
Col * CellWidth, row * CellHeight, (Col + 1 )
* CellWidth, (row + 1 )
* CellHeight, 0 );
}
GfxSelectPen( colorBlue );
for( i = 0;
i < 10 && i < BarCount;
i++ )
{
for( k = 0;
k < 5; k++ )
{
PrintInCell( "Button " +
i + "," + k, i, k );
}
GfxMoveTo( 0,
i * CellHeight );
GfxLineTo( 5 *
CellWidth, i * CellHeight );
}
GfxMoveTo( 0,
i * CellHeight );
GfxLineTo( 5 *
CellWidth, i * CellHeight );
for( Col = 1;
Col < 6; Col++ )
{
GfxMoveTo( Col * CellWidth, 0);
GfxLineTo( Col * CellWidth, 10 *
CellHeight );
}
/////////////////////////////////////////////////////////
// Part 2: MOUSE BUTTON CALL BACKS
//////////////////////////////////////////////////////////
Title="";
function DrawButton(
px, py, Clr1, Clr2, text )
{
Col = floor( px / CellWidth
);
Row = floor( py / CellHeight
);
GfxGradientRect(
Col * CellWidth, row * CellHeight, (Col + 1 )
* CellWidth, (row + 1 )
* CellHeight,
Clr1, Clr2 );
PrintInCell( text + " " +
row + "," + Col, row, Col
);
}
function OnLMouseButton(x,
y, px, py)
{
_TRACE("LButton
x = " + DateTimeToStr(
x ) + " y = " + y );
DrawButton( px, py, ColorHSB( 50, 255, 255 ), ColorHSB( 90, 255, 255 ), "just
clicked" );
}
function OnRMouseButton(x,
y, px, py)
{
_TRACE("RButton
x = " + DateTimeToStr(
x ) + " y = " + y );
}
function OnMMouseButton(x,
y, px, py)
{
_TRACE("MButton
x = " + DateTimeToStr(
x ) + " y = " + y );
}
function OnHoverMouse(x,
y, px, py)
{
_TRACE("LButton
x = " + DateTimeToStr(
x ) + " y = " + y );
DrawButton( px, py, ColorRGB( 230, 230, 230 ), ColorRGB( 255, 255, 255 ), "mouse
over" );
}
function OnLButtonIsDown(x,
y, px, py)
{
_TRACE("LButton
x = " + DateTimeToStr(
x ) + " y = " + y );
DrawButton( px, py, ColorHSB( 190, 255, 255 ), ColorHSB( 210, 255, 255 ), "down" );
}
/////////////////////////////////////////////////////////
// Part 3: GENERAL PURPOSE EVENT HANDLER (reusable!
- may be put into "include" file)
////////////////////////////////////////////////////////
function EventHandler()
{
local b, x, y, px,
py;
b = GetCursorMouseButtons();
// retrieve co-ordinates in date/value units
x = GetCursorXPosition(0);
y = GetCursorYPosition(0);
// retrieve co-ordinates in pixel units
px = GetCursorXPosition(1);
py = GetCursorYPosition(1);
if( b & 8 ) //
flag = 8 is set when window just received mouse click
{
// not-null means clicked in THIS (current) window
if( b & 1 )
OnLMouseButton( x, y, px, py );
if( b & 2 )
OnRMouseButton( x, y, px, py );
if( b & 4 )
OnMMouseButton( x, y, px, py );
}
else
{
if(
b == 0 ) OnHoverMouse(
x, y, px, py ); // no button pressed
if(
b == 1 ) OnLButtonIsDown(
x, y, px, py ); // button pressed
}
}
EventHandler();
RequestTimedRefresh( 1 );
CHANGES FOR VERSION 5.04.2 (as compared to 5.04.1)
2. New "mode" parameter controls what values are returned
GetCursorXPosition( mode = 0 )
GetCursorYPosition( mode = 0 )
mode = -1 - (old compatibility mode) - x - value gives X-coordinate
in DateTime format. y - value gives PRICE. Values are reported no matter
where is the mouse (i.e. may refer to window different than current if
mouse is outside current window).
mode = 0 - (default) x - value gives X-coordinate in DateTime format.
y - value gives PRICE. Returns NULL if mouse is outside current window
mode = 1 - x, y - are mouse coordinates expressed in screen PIXELS. Returns
NULL if mouse is outside current window
CHANGES FOR VERSION 5.04.1 (as compared to 5.04.0)
PlotForeign("~~~ISEQUITY","In-Sample
Equity", colorRed, styleLine);
PlotForeign("~~~OSEQUITY","Out-Of-Sample
Equity", colorGreen, styleLine);
Title = "{{NAME}}
- {{INTERVAL}} {{DATE}} {{VALUES}}";
CHANGES FOR VERSION 5.04.0 (as compared to 5.03.0)
CHANGES FOR VERSION 5.03.0 (as compared to 5.02.2)
CHANGES FOR VERSION 5.02.2 (as compared to 5.02.1)
CHANGES FOR VERSION 5.02.1 (as compared to 5.01.1)
CHANGES FOR VERSION 5.01.1 (as compared to 5.01.0)
CHANGES FOR VERSION 5.01.0 (as compared to 5.00.0)
HOW TO REPORT BUGS
If you experience any problem with this beta version please send detailed description of the problem (especially the steps needed to reproduce it) to support at amibroker.com