Amibroker Guislider function help

Hello,

I am using the below code to navigate through pages. Is there any alternative or better way of getting the same result? The slider seems to be too big. I don't have more than 10 pages

// GFX Drawing Example
Page = GuiSlider( 1, 5, 20, 100, 25, 80 );
Page = GuiGetValue( 1 );
SymbolNum = Page * NumCharts;

image

Thank you

@amisur, as per the Using on-chart GUI controls tutorial (a must read!):

Page = 1; // your page index

idSlider = 1;
function CreateGUI()
{
    if( GuiSlider( idSlider, 10, 30, 200, 30, notifyEditChange ) == guiNew )
    {
        // init values on control creation
        GuiSetValue( idSlider,  Page );
        GuiSetRange( idSlider, 1, 10, 1, 1 );
    }
}

function HandleEvents()
{
    for( n = 0; id = GuiGetEvent( n, 0 ); n++ )  // get the id of the event
    {
        code = GuiGetEvent( n, 1 );

        switch( id )
        {
            case idSlider:
                // do something
                Page = GuiGetValue( idSlider );
                break;
			// ... handle other GUI controls
			
            default:
                break;
        }
    }
}

CreateGUI();
HandleEvents();

Title = "Page: " + Page;

As you can see, you need to set the slider range when you create it (please, apply the above sample code to a new chart or pane).
I don't know if it's a good idea to use a slider to change pages. I would probably use 10 small GUI buttons.

1 Like

Why don’t you just use built in chart sheets

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.