diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2011-01-30 21:31:45 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2011-01-30 21:31:45 +0100 |
commit | c4e41abb01399ea5a38997619286a50f83927c71 (patch) | |
tree | b96f8bc2bfe70a9dccb5ba0487d8c90057096a5d | |
parent | 66de2ac642b5657e28842c5dbc8e7d83f3f28975 (diff) | |
download | tvisiontest-c4e41abb01399ea5a38997619286a50f83927c71.tar.gz tvisiontest-c4e41abb01399ea5a38997619286a50f83927c71.tar.bz2 |
using more modern form run call
-rw-r--r-- | src/newt/test1.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/newt/test1.cpp b/src/newt/test1.cpp index 61185d6..fc8c939 100644 --- a/src/newt/test1.cpp +++ b/src/newt/test1.cpp @@ -1,6 +1,8 @@ #include <iostream> +extern "C" { #include <newt.h> +} using namespace std; @@ -21,7 +23,7 @@ int main( void ) newtOpenWindow( 10, 3, 60, 18, "form1" ); // construct the components of the form and the form itself - newtComponent form, answer, label1, inputline1, + newtComponent form, label1, inputline1, label2, inputline2, ok, cancel; form = newtForm( NULL, NULL, 0 ); @@ -40,16 +42,29 @@ int main( void ) newtFormAddComponents( form, label1, inputline1, label2, inputline2, ok, cancel, NULL ); // run the form - answer = newtRunForm( form ); + struct newtExitStruct result; + newtFormRun( form, &result ); // cleanup newtPopWindow( ); newtFinished( ); - if( answer == ok ) { - cout << "OK" << endl; - } else if( answer == cancel ) { - cout << "Cancel" << endl; + 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; + break; + + case newtExitStruct::NEWT_EXIT_FDREADY: + cout << "FDREADY(" << result.u.watch << ")" << endl; + break; + + case newtExitStruct::NEWT_EXIT_TIMER: + cout << "TIMER" << endl; + break; } return 0; |