diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2011-01-30 20:48:08 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2011-01-30 20:48:08 +0100 |
commit | 4d0bd3c4a539bc359c1ae05acba1c8716437d38a (patch) | |
tree | 3e03b9dcdf0ab5512572f584ae74f07474fb9ddf | |
parent | 66d8c4b47f179bb66116855ba4b7bf6f05d45b18 (diff) | |
download | tvisiontest-4d0bd3c4a539bc359c1ae05acba1c8716437d38a.tar.gz tvisiontest-4d0bd3c4a539bc359c1ae05acba1c8716437d38a.tar.bz2 |
-
-rw-r--r-- | src/newt/test1.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/newt/test1.cpp b/src/newt/test1.cpp new file mode 100644 index 0000000..a59225e --- /dev/null +++ b/src/newt/test1.cpp @@ -0,0 +1,47 @@ +#include <iostream> + +#include <newt.h> + +using namespace std; + +int main( void ) +{ + newtInit( ); + newtCls( ); + newtDrawRootText( 0, 0, "SMERP newt client" ); + newtDrawRootText( 75, 0, "(C)2011" ); + newtDrawRootText( 1, -1, "<Tab>/<Shift-Tab> between elements" ); + + newtOpenWindow( 10, 3, 60, 18, "form1" ); + + newtComponent form, answer, label1, inputline1, + label2, inputline2, ok, cancel; + + form = newtForm( NULL, NULL, 0 ); + label1 = newtTextbox( 2, 1, 20, 1, 0 ); + newtTextboxSetText( label1, "First name:" ); + const char *str1 = ""; + inputline1 = newtEntry( 20, 1, str1, 20, &str1, + NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT ); + label2 = newtTextbox( 2, 2, 20, 1, 0 ); + newtTextboxSetText( label2, "Second name:" ); + const char *str2 = ""; + inputline2 = newtEntry( 20, 2, str2, 20, &str2, + NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT ); + ok = newtCompactButton( 4, 10, "Ok" ); + cancel = newtCompactButton( 20, 10, "Cancel" ); + newtFormAddComponents( form, label1, inputline1, label2, inputline2, ok, cancel, NULL ); + + answer = newtRunForm( form ); + + newtPopWindow( ); + newtFinished( ); + + if( answer == ok ) { + cout << "OK" << endl; + } else if( answer == cancel ) { + cout << "Cancel" << endl; + } + + return 0; +} |