1 /*
2  *  This file is part of XForms.
3  *
4  *  XForms is free software; you can redistribute it and/or modify it
5  *  under the terms of the GNU Lesser General Public License as
6  *  published by the Free Software Foundation; either version 2.1, or
7  *  (at your option) any later version.
8  *
9  *  XForms is distributed in the hope that it will be useful, but
10  *  WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  *  Lesser General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Lesser General Public
15  *  License along with XForms; see the file COPYING.  If not, write to
16  *  the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
17  *  MA 02111-1307, USA.
18  */
19 
20 
21 /* Demo showing secret input fields
22 */
23 
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27 
28 #include <stdio.h>
29 #include "include/forms.h"
30 
31 
32 /***************************************
33  ***************************************/
34 
35 int
main(int argc,char * argv[])36 main( int    argc,
37       char * argv[ ] )
38 {
39     FL_FORM *form;
40     FL_OBJECT *but,
41               *password1,
42               *password2,
43               *info;
44    char str[ 256 ];
45 
46    fl_initialize( &argc, argv, "FormDemo", 0, 0 );
47 
48    form = fl_bgn_form( FL_UP_BOX, 400, 300 );
49 
50    password1 = fl_add_input( FL_SECRET_INPUT, 140, 40, 160, 40, "Password 1:" );
51    fl_set_object_return( password1, FL_RETURN_CHANGED );
52 
53    password2 = fl_add_input( FL_SECRET_INPUT, 140, 100, 160, 40,
54                              "Password 2:" );
55    fl_set_object_return( password2, FL_RETURN_CHANGED );
56 
57    info = fl_add_box( FL_SHADOW_BOX, 20, 160, 360, 60, "" );
58 
59    but = fl_add_button( FL_NORMAL_BUTTON, 280, 240, 100, 40, "Quit" );
60 
61    fl_end_form( );
62 
63    fl_show_form( form, FL_PLACE_MOUSE, FL_FULLBORDER, "Secret Input Demo" );
64 
65    while ( fl_do_forms( ) != but )
66    {
67        sprintf( str, "Password 1 is: %s\n, Password 2 is: %s",
68                 fl_get_input( password1 ), fl_get_input( password2 ) );
69        fl_set_object_label( info, str );
70    }
71 
72    fl_finish( );
73    return 0;
74 }
75 
76 
77 /*
78  * Local variables:
79  * tab-width: 4
80  * indent-tabs-mode: nil
81  * End:
82  */
83