diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2011-01-30 21:37:05 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2011-01-30 21:37:05 +0100 |
commit | 674a2a1e18d0f0c5e7445d35a17396cf9ac6dd4b (patch) | |
tree | cc1199fa32e00cd8323f2f9deb82ceebf40df530 | |
parent | c4e41abb01399ea5a38997619286a50f83927c71 (diff) | |
download | tvisiontest-674a2a1e18d0f0c5e7445d35a17396cf9ac6dd4b.tar.gz tvisiontest-674a2a1e18d0f0c5e7445d35a17396cf9ac6dd4b.tar.bz2 |
-
-rw-r--r-- | src/newt/test1.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/newt/test1.cpp b/src/newt/test1.cpp index fc8c939..d1c33de 100644 --- a/src/newt/test1.cpp +++ b/src/newt/test1.cpp @@ -41,6 +41,9 @@ int main( void ) cancel = newtCompactButton( 20, 10, "Cancel" ); newtFormAddComponents( form, label1, inputline1, label2, inputline2, ok, cancel, NULL ); + // set timeout + newtFormSetTimer( form, 10000 ); + // run the form struct newtExitStruct result; newtFormRun( form, &result ); @@ -50,18 +53,22 @@ int main( void ) newtFinished( ); switch( result.reason ) { - case newtExitStruct::NEWT_EXIT_HOTKEY: - cout << "EXITKEY(" << result.u.key << ")" << endl; - break; - case newtExitStruct::NEWT_EXIT_COMPONENT: cout << "COMPONENT EXIT(" << result.u.co << ")" << endl; + if( result.u.co == ok ) { + cout << "Ok" << endl; + } else if( result.u.co == cancel ) { + cout << "Cancel" << endl; + } + break; + + case newtExitStruct::NEWT_EXIT_HOTKEY: + cout << "EXITKEY(" << result.u.key << ")" << endl; break; case newtExitStruct::NEWT_EXIT_FDREADY: cout << "FDREADY(" << result.u.watch << ")" << endl; break; - case newtExitStruct::NEWT_EXIT_TIMER: cout << "TIMER" << endl; break; |