I have a do-file that first collects username and password via dialog box, then proceeds to query an API. But the issue I'm facing is that Stata opens the dialog box but doesn't wait for the user to press the "Ok" button, it just keeps powering through. I know "window stopbox" would have waited for the user, but I need the customization of the dialog box. Could someone please point out how to get this waiting behavior?
Thank you in advance for your help,
Diana
HTML Code:
// The dialog box opens db login // But it doesn't wait for the user to answer, so the global $un is still empty here noisily display "You provided login info for $un" // Which makes the query using $un and $password fail here ------------login.dlg-------------------- VERSION 16.0 POSITION . . 350 160 DIALOG main, label("Authentication for API download") tabtitle("Main") BEGIN TEXT tx_hi1 10 10 330 ., label("Your login information will be stored as globals in this Stata") TEXT tx_hi2 10 +15 330 ., label("session, but it will not kept beyond this session") TEXT tx_un 10 +30 330 ., label("Username:") EDIT ed_un 10 +20 140 ., error(Username) TEXT tx_pwd 10 +25 330 ., label("Password:") EDIT ed_pwd 10 +20 330 ., nomemory password error(Password) END OK ok1, label("OK") CANCEL can1, label("Cancel") RESET res1 PROGRAM command BEGIN put "global un " require main.ed_un put main.ed_un stata hidden immediate clear put "global password " put main.ed_pwd require main.ed_pwd stata hidden immediate clear END
0 Response to Dialog box: how to force waiting for user's input?
Post a Comment