From 4d0bd3c4a539bc359c1ae05acba1c8716437d38a Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 30 Jan 2011 20:48:08 +0100 Subject: - --- src/newt/test1.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/newt/test1.cpp 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 + +#include + +using namespace std; + +int main( void ) +{ + newtInit( ); + newtCls( ); + newtDrawRootText( 0, 0, "SMERP newt client" ); + newtDrawRootText( 75, 0, "(C)2011" ); + newtDrawRootText( 1, -1, "/ 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; +} -- cgit v1.2.3-54-g00ecf