add cancel button to intro dialog

This commit is contained in:
cy384 2020-07-20 15:30:56 -04:00
parent 516e60887f
commit bd24d05a91
2 changed files with 9 additions and 3 deletions

View File

@ -356,7 +356,7 @@ void ssh_setup_terminal(void)
SSH_CHECK(libssh2_channel_shell(ssh_con.channel)); SSH_CHECK(libssh2_channel_shell(ssh_con.channel));
} }
void intro_dialog(char* hostname, char* username, char* password) int intro_dialog(char* hostname, char* username, char* password)
{ {
// modal dialog setup // modal dialog setup
@ -394,7 +394,7 @@ void intro_dialog(char* hostname, char* username, char* password)
short item; short item;
do { do {
ModalDialog(NULL, &item); ModalDialog(NULL, &item);
} while(item != 1); } while(item != 1 && item != 9);
// copy the text out of the boxes // copy the text out of the boxes
GetDialogItemText((Handle)address_text_box, hostname); GetDialogItemText((Handle)address_text_box, hostname);
@ -404,6 +404,9 @@ void intro_dialog(char* hostname, char* username, char* password)
// clean it up // clean it up
CloseDialog(dlg); CloseDialog(dlg);
FlushEvents(everyEvent, -1); FlushEvents(everyEvent, -1);
// if we hit cancel, 0
if (item == 9) return 0; else return 1;
} }
//enum { WAIT, READ, EXIT } read_thread_command = WAIT; //enum { WAIT, READ, EXIT } read_thread_command = WAIT;
@ -461,7 +464,7 @@ int main(int argc, char** argv)
InitWindows(); InitWindows();
InitMenus(); InitMenus();
intro_dialog(hostname, username, password); if (!intro_dialog(hostname, username, password)) return 0;
console_setup(); console_setup();

View File

@ -36,6 +36,9 @@ resource 'DITL' (128) {
{ 135, 10, 151, 310 }, { 135, 10, 151, 310 },
EditText { enabled, "" }; EditText { enabled, "" };
{ 190-10-20, 10, 190-10, 90 },
Button { enabled, "Cancel" };
} }
}; };