From: "Michael Stewart" Newsgroups: comp.os.msdos.djgpp References: Subject: Re: dj callbacks Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Original-NNTP-Posting-Host: 212.49.228.226 Message-ID: <3932bbac@news.server.worldonline.co.uk> Date: Mon, 29 May 2000 19:51:33 +0100 NNTP-Posting-Host: 212.49.224.15 X-Trace: server12-lon1.london1.l3.net 959626157 212.49.224.15 (Mon, 29 May 2000 19:49:17 BST) NNTP-Posting-Date: Mon, 29 May 2000 19:49:17 BST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Paul Cechner wrote in message news:ulmY4.563$x8 DOT 4314 AT nsw DOT nnrp DOT telstra DOT net... > can you set up your own custom callbacks in dj?? and how??? Of course > ie, can you (for instance) create a myObj::user_callback_handler() method > which you initialise to be called when a certain trigger is thrown elsewhere > (ie, myBouncingObject::triggerThrower())? sort of reaction based > programming.... Sure, see below. > im not sure what terminology to use, so i hope you understand what im > talking about. I think you are refering to event driven programming. > i want to use this to call a certain handler when some non-specific trigger > is thrown (ie, bringing up a menu when a any number of user actions is > performed) This is taken from Allegro /* install_keyboard_hooks: * You should only use this function if you *aren't* using the rest of the * keyboard handler. It can be called in the place of install_keyboard(), * and lets you provide callback routines to detect and read keypresses, * which will be used by the main keypressed() and readkey() functions. This * can be useful if you want to use Allegro's GUI code with a custom * keyboard handler, as it provides a way for the GUI to access keyboard * input from your own code. */ void install_keyboard_hooks(int (*keypressed)(), int (*readkey)()) { keypressed_hook = keypressed; readkey_hook = readkey; } Mike