Duplicate id found error

hi all

when i use this function i get this error .

Duplicate id found control ids must be unique

i use the function in the same FLA

1 -

function EIOWEditNumber( idEdit, initialValue, EIOW_x, EIOW_y, width, height, textColor, bgColor )
{  // this function hold the text for the next restart of Amibroker
    global _x0, _y0;
    local rc ;

    EIOW_x = EIOW_x + _x0;     EIOW_y = EIOW_y + _y0;
    rc = GuiEdit( idEdit, EIOW_x, EIOW_y, width, height, notifyHitReturn ); //

    ID = GuiGetEvent( 0, 0 );     event = GuiGetEvent( 0, 1 );
    if( ID == idEdit ) StaticVarSetText( "sV" + Name() + idEdit,  GuiGetText( idEdit ), 1 );

    if( rc == guiNew )
    {  // after restart Amibroker read FIRST these Static Line
        txt = StaticVarGettext( "sV" + Name() + idEdit );
        GuiSetText( txt, idEdit );
    }

    GuiSetColors( idEdit, idEdit, 5, colorWhite, colorYellow, colorLightGrey );

    return GuiGetValue( idEdit );
}

2-

function MAQEditNumber( idEdit, initialValue,  MD_MAQ_x,  MD_MAQ_y, width, height, textColor, bgColor )
{  // this function hold the text for the next restart of Amibroker
    global _x0, _y0;
    local rc ;

     MD_MAQ_x =  MD_MAQ_x + _x0;      MD_MAQ_y =  MD_MAQ_y + _y0;
    rc = GuiEdit( idEdit,  MD_MAQ_x,  MD_MAQ_y, width, height, notifyHitReturn ); //

    ID = GuiGetEvent( 0, 0 );     event = GuiGetEvent( 0, 1 );
    if( ID == idEdit ) StaticVarSetText( "sV" + Name() + idEdit,  GuiGetText( idEdit ), 1 );

    if( rc == guiNew )
    {  // after restart Amibroker read FIRST these Static Line
        txt = StaticVarGettext( "sV" + Name() + idEdit );
        GuiSetText( txt, idEdit );
    }

    GuiSetColors( idEdit, idEdit, 5, colorWhite, colorYellow, colorLightGrey );

    return GuiGetValue( idEdit );
}
 

thank you for your help

Hi
Every Gui button Must have a unique control ID.

That means somewhere in your AFL you wrote the same number for gui ID.
And for that reason Amibroker telling you that is NOT allowed .

So check your AFL find where you have entered the same number as ID and change it with another number that you have not used until now in the same AFL

To make it more clear for you, the ID is in the first parameter of your custom function

MAQEditNumber( idEdit,
// example below :  
// 3 different  Gui Buttons with 3 different  ID 
MAQEditNumber( 1,
MAQEditNumber( 2,
MAQEditNumber( 3,
3 Likes

thank you for your reply