Button within a loop

Discussão em 'StackOverflow' iniciado por fdantas, Setembro 24, 2015.

  1. fdantas

    fdantas Administrator Moderador

    I'm a progress newbie, Below is my current code, with tableNames and fieldnames change to protect the innocent. I want to loop through records in a db, and within that loop include a button, so that while looping through each record one by one if someone wants to change something they can. I have the below code looping through the records fine (without the button element included below) and I have the button element working fine in a separate buffer but when I bring the button into the loop the loop runs fine, but stops after the first button. When I try to continue the button code runs. I want to include a button but it only runs the procedure if it is clicked. If I remove the line 'WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.' the loop continues as I would want and the button appears, however the button is rendered unclickable. Any help apprecaited.

    define variable cInsertCompany as character format "x(50)" label "Enter the company name:" no-undo.
    define variable cCompanyName as character format "x(50)".
    prompt-for cInsertCompany.
    assign cCompanyName = input cInsertCompany.

    for each tableName where client = 'tgl',
    each otherTableName where tableName.ref = otherTableName.ref and TableName.name matches '*' + cCompanyName + '*':
    display
    tablename.nrname
    tablename.otherfield.

    DEFINE BUTTON bUpdate LABEL "Update".
    DEFINE FRAME btn-frame WITH SIZE 10 BY 2.
    ENABLE bUpdate WITH FRAME btn-frame.

    ON CHOOSE OF bUpdate DO:
    RUN btn-mess.
    END.

    VIEW FRAME btn-frame.

    WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.


    PROCEDURE btn-mess.
    MESSAGE "Hello" SKIP "You have selected the new button"
    VIEW-AS ALERT-BOX INFO BUTTONS OK.
    END PROCEDURE.

    end.

    Continue reading...

Compartilhe esta Página