# data file for the Fltk User Interface Designer (fluid) version 1.0106 header_name {.h} code_name {.cpp} decl {\#include} {} decl {\#include} {} decl {\#include} {} decl {using namespace std;} {} decl {bool vfrau=false;} {} decl {bool vherr=false;} {} decl {char*vvorname;} {} decl {char*vnachname;} {} decl {int vday;} {} decl {int vmonth;} {} decl {int vyear;} {} Function {submit(Fl_Widget*w,void*)} {open return_type {static void} } { code {bool mistake = false;} {} code {//Überprüfung der Anrede if (vherr == vfrau) mistake = true;} {} code {//Überprüfung der Namen if (strcmp("",vorname->value()) == 0 || strcmp("",nachname->value()) == 0) mistake = true; else { vvorname = (char*)vorname->value(); vnachname = (char*)nachname->value(); }} {} code {//Überprüfung Datum vday = day->value()+1; vmonth = month->value()+1; sscanf (year->value(), "%i", &vyear); //Überprüfung ob Tag und Monat gültige Werte haben if (vday <= 0 || vday >= 32 || vmonth <= 0 || vmonth >= 13) mistake = true; //Überprüfung für "31." April, Juni, September und November if ( (vday == 31) && (vmonth == 4 || vmonth == 6 || vmonth == 9 || vmonth == 11) ) mistake = true; //Überprüfung für Februar und Schaltjahr if ( vmonth == 2 && vday > 28) { if ( vyear % 4 != 0 || vyear % 400 == 0 || vday > 29 ) mistake = true; } //zu alte und noch nicht geborene gelten auch nicht if (vyear > 2005 || vyear < 1900) mistake = true;} {} code {//Auswertung von "mistake" if (mistake == false) result()->show(); else failure()->show();} {} } Function {result()} {open return_type {Fl_Window*} } { code {std::stringstream outstream; std::string datum; if (vday < 10) outstream<<"0"; outstream<value("Frau");} code1 {if (vherr == true) showanrede->value("Herr");} } Fl_Output showvorname { label {Vorname:} private xywh {141 45 150 25} box NO_BOX labelfont 1 code0 {showvorname->value(vvorname);} } Fl_Output shownachname { label {Nachname:} private xywh {141 65 150 25} box NO_BOX labelfont 1 code0 {shownachname->value(vnachname);} } Fl_Output showdatum { label {Geburtsdatum:} private xywh {141 85 99 25} box NO_BOX labelfont 1 code0 {showdatum->value(datum.c_str());} } } code {return w;} {} } Function {failure()} {open return_type {Fl_Window*} } { Fl_Window {} { label Zusammenfassung open xywh {451 340 286 137} type Double hide } { Fl_Box {} { image {E:/FLUID-Tutorial/tutorial04/fehler.gif} xywh {100 10 100 100} align 26 } } code {return w;} {} } Function {} {open } { Fl_Window {} {open xywh {225 288 361 175} type Single hide } { Fl_Group {} { label {Anrede:} xywh {25 25 350 25} align 21 } { Fl_Round_Button {} { label Frau callback {vfrau = true; vherr = false;} xywh {100 25 15 15} type Radio down_box ROUND_DOWN_BOX } Fl_Round_Button {} { label Herr callback {vfrau = false; vherr = true;} xywh {200 25 15 15} type Radio down_box ROUND_DOWN_BOX } } Fl_Input vorname { label {Vorname:} xywh {92 50 200 25} } Fl_Input nachname { label {Nachname:} xywh {93 75 200 25} } Fl_Choice day { label {Tag:} xywh {36 115 45 20} down_box BORDER_BOX } { menuitem {} { label 1 xywh {0 0 100 20} } menuitem {} { label 2 xywh {10 10 100 20} } menuitem {} { label 3 xywh {20 20 100 20} } menuitem {} { label 4 xywh {30 30 100 20} } menuitem {} { label 5 xywh {40 40 100 20} } menuitem {} { label 6 xywh {50 50 100 20} } menuitem {} { label 7 xywh {60 60 100 20} } menuitem {} { label 8 xywh {70 70 100 20} } menuitem {} { label 9 xywh {80 80 100 20} } menuitem {} { label 10 xywh {90 90 100 20} } menuitem {} { label 11 xywh {100 100 100 20} } menuitem {} { label 12 xywh {110 110 100 20} } menuitem {} { label 13 xywh {120 120 100 20} } menuitem {} { label 14 xywh {130 130 100 20} } menuitem {} { label 15 xywh {140 140 100 20} } menuitem {} { label 16 xywh {150 150 100 20} } menuitem {} { label 17 xywh {160 160 100 20} } menuitem {} { label 18 xywh {170 170 100 20} } menuitem {} { label 19 xywh {180 180 100 20} } menuitem {} { label 20 xywh {190 190 100 20} } menuitem {} { label 21 xywh {200 200 100 20} } menuitem {} { label 22 xywh {210 210 100 20} } menuitem {} { label 23 xywh {220 220 100 20} } menuitem {} { label 24 xywh {230 230 100 20} } menuitem {} { label 25 xywh {240 240 100 20} } menuitem {} { label 26 xywh {250 250 100 20} } menuitem {} { label 27 xywh {260 260 100 20} } menuitem {} { label 28 xywh {270 270 100 20} } menuitem {} { label 29 xywh {280 280 100 20} } menuitem {} { label 30 xywh {290 290 100 20} } menuitem {} { label 31 xywh {300 300 100 20} } } Fl_Choice month { label {Monat:} xywh {132 115 100 20} down_box BORDER_BOX } { menuitem {} { label Januar xywh {0 0 100 20} } menuitem {} { label Februar xywh {10 10 100 20} } menuitem {} { label {März} xywh {20 20 100 20} } menuitem {} { label April xywh {30 30 100 20} } menuitem {} { label Mai xywh {40 40 100 20} } menuitem {} { label Juni xywh {50 50 100 20} } menuitem {} { label Juli xywh {60 60 100 20} } menuitem {} { label August xywh {70 70 100 20} } menuitem {} { label September xywh {80 80 100 20} } menuitem {} { label Oktober xywh {90 90 100 20} } menuitem {} { label November xywh {100 100 100 20} } menuitem {} { label Dezember xywh {110 110 100 20} } } Fl_Input year { label {Jahr:} xywh {275 115 75 20} type Int } Fl_Button {} { label OK callback submit xywh {275 145 75 20} } } }