From: Forsberg Sakari Newsgroups: comp.os.msdos.djgpp Subject: Allegro && DEGUI && edittext_object && problems... Date: 25 Nov 1999 10:54:29 GMT Organization: Tampere University of Technology Lines: 91 Message-ID: <81j4h5$hmo$1@baker.cc.tut.fi> NNTP-Posting-Host: assari.cc.tut.fi X-Trace: baker.cc.tut.fi 943527269 18136 130.230.10.21 (25 Nov 1999 10:54:29 GMT) NNTP-Posting-Date: 25 Nov 1999 10:54:29 GMT User-Agent: tin/pre-1.4-981225 ("Volcane") (UNIX) (OSF1/V4.0 (alpha)) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi! I tried to make a wrapper for edittext_object, which checks the string that user has entered when he/she presses enter, but I couldn't make a decent destructor for it! i added following lines to ::msg_char -function ////////////////////////// else if((c>>8)==KEY_ENTER) { vaihda_viikko(); } ////////////////////////// and that works fine. It calls that function fine. this is copy of my header-file... /////////////////////////////////////// class edittext_withsc :public edittext_object { public: virtual bool msg_char( const int ); edittext_withsc( const char *teksti, const int pituus ) : edittext_object( teksti, pituus ) { }; virtual ~edittext_withsc( void ); }; /////////////////////////////////////// constructor works fine... btw: is it legal to put void (*)() //pointer to any function in that constructor... that way I could use different kind of functions to check out what kind of input there is... finally... when I thought everything is fine, my program crashes when I exit from it. // Destructor edittext_withsc::~edittext_withsc (void) { delete text; } So is there something wrong with my destructor????? Thank you in advance! Ps. here is a class where I derived my class class edittext_object :public dialog_object { private: // Some internal helper functions void draw_text (void); void setup (const char*, const int); protected: char *text; int max_length; int cursorpos; int offsetpos; public: // Message functions virtual void msg_draw (void); virtual void msg_click (void); virtual bool msg_char (const int); // Constructors and destructors edittext_object (const int = 14); edittext_object (const char*, const int = 14); virtual ~edittext_object (void); // Set and get the text out void set_text (const char*, const int len = -1); char* get_text (void) { return text; }; }; // Destructor edittext_object::~edittext_object (void) { delete text; } ** Sakari Forsberg zacu AT cc DOT tut DOT fi ** ** Information: finger zacu AT assari DOT cc DOT tut DOT fi **