[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Increase and decrease a var with two GFX buttons.



PureBytes Links

Trading Reference Links



not sure about the answer to your question but I am sure you know about the code on buttons that has been published in the UKB. You might also want to check this library entry which I also still have to study but looks very interesting:
 
 
regards, Ed
 
 
 
 
 
----- Original Message -----
From: Reinsley
Sent: Saturday, November 07, 2009 6:58 PM
Subject: [amibroker] Increase and decrease a var with two GFX buttons.

 

Hello,

I would like to decrease Myparam of 0.25 on each clic inside the red button.

I complicated with static var but Myparam comes back to 5 as it is declared at the beginning of the formula.

How to decrease a var with a GFX button ?

To give an idea of what I want to do , once this point solved, my next step will be to increase of 0.25 the same Myparam with a Plus button to adjust a Fibonacci step. I will add Fibonacci code at the very end.

AB parameters windows lacks some ergonomics in real time.

I draw the buttons in the upper right side, after the bars, as quote marker will not be activate.

Thanks for the help

Best regards

// draw a red square + inside click

//SetChartOptions( 2, chartHideQuoteMarker );

Myparam = Param( "TheValue", 5, 0, 5, 0.25 );
StaticVarSet( "Myparamstat ", Myparam );

Myparam = StaticVarGet( "Myparamstat " );
_TRACE( "Myparamstat = " + Myparam );

function DrawButton( Text, x1, y1, x2, y2, BackColor )
{
GfxSetOverlayMode( 0 );
GfxSelectFont( "Tahoma", 12, 800 );
GfxSelectPen( colorBlack );
GfxSetBkMode( 1 );
GfxSelectSolidBrush( BackColor );
GfxSetBkColor( BackColor );
GfxSetTextColor( 1 );
GfxRectangle( x1, y1, x2, y2 );
GfxDrawText( Text, x1, y1, x2, y2, 32 | 1 | 4 );
}

shift = 40;
XOffset = StaticVarGet( "XOffset" );
YOffset = StaticVarGet( "YOffset" );

pxchartwidth = Status( "pxchartwidth" );
XOffset = pxchartwidth - shift ; // X1
YOffset = 0;//Y1
SquareSide = 20;

X1m = XOffset ;
X2m = Xoffset + SquareSide ;
Y1m = YOffset ;
Y2m = yOffset + SquareSide ;

DrawButton( "-", Xoffset, yOffset, Xoffset + SquareSide , yOffset + SquareSide , colorRed );

LButtonTrigger = GetCursorMouseButtons() == 9;
_TRACE( "LButtonTrigger = " + LButtonTrigger );

if ( LButtonTrigger )
{
MousePx = Nz( GetCursorXPosition( 1 ) );
MousePy = Nz( GetCursorYPosition( 1 ) );

CursorInMinus = MousePx > X1m AND MousePx < X2m AND MousePy > Y1m AND MousePy < Y2m;
_TRACE( "CursorInMinus = " + CursorInMinus );

if ( CursorInMinus )
{
DrawButton( "-", Xoffset, yOffset, Xoffset + SquareSide , yOffset + SquareSide , colorYellow );
Myparam = StaticVarGet( "Myparamstat " );
Myparam = Myparam - 0.25;
_TRACE( "Myparamstat2 = " + Myparam );
RequestTimedRefresh( 1 );
}
}



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___