[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

Hello Ed,

Yes, I started from examples in the UKB. I missed the library entry, 
however this code is huge and not easy to understand the vars.
Thank you to point this interesting formula, a lot of things to dissect...

One of the many issues I met before to see the Aron's example is in the 
following code.
For some reason, the default value is 1 as I expected 10 !
AB's rules have reasons that basic user ignores.

// param static var

pds = Param("pds", 10, 5, 100, 1);
pds = StaticVarSet("pds", pds);
Title = "pds: " + pds;

Best regards



Edward Pottasch a écrit :
>  
> 
> 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:
>  
> http://www.amibroker.com/members/library/formula.php?id=1175 
> <http://www.amibroker.com/members/library/formula.php?id=1175>
>  
> regards, Ed
>  
>  
>  
>  
>  
> 
>     ----- Original Message -----
>     *From:* Reinsley <mailto:reinsley@xxxxxxxx>
>     *To:* amibroker@xxxxxxxxxxxxxxx <mailto:amibroker@xxxxxxxxxxxxxxx>
>     *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/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/