PDA

View Full Version : commoditie + keys handler


kas1e
11-23-2004, 08:44 AM
hello all. i want write commodie tool with key handler. i need handle some keys (not one, maybe 5-10). So, as i know, for software key handler aos have IDCMP flags for it: RAWKEY and VANILLAKEY. but IDCMP flags for active window only. I need anytime handler.

In rkrm3 i found some commoditie examples without IDCMP flags, with ArgString() func from amiga.lib. It's work anytime, not need window, only broker, but it trick only for one key. I try seatch on aminet, and in all case see only key handlers for active window, or only one key handler for argstring(). I need some like this:

#define some keys, 1,2,3 for example. //??

CxBase=OpenLibrary("commodities.library",37L);
broker = CxBroker(&newbroker, NULL);
ActivateCxObj(broker, 1L);

<here put handler to broker> // ??

processmesg(); //??

DeleteCxObj(broker); // remove commoditie
CloseLibrary(CxBase); // close lib

/////////////////////////////////////
processmesg()
{
switch(....)
{
case Key_1:
printf("pressed key_1\n");
break;
case Key_2:
printf("pressed key_2\n");
break;
case Key_3:
printf("pressed key_3\n");
break;
}
};


So, i need little sample for anytime commoditie key handler.
thanx all for advance.

Thomas
11-24-2004, 03:52 AM
AFAIK you have to create a seperate Filter/Sender/Translate combination for each key and attach it to the Broker.

There is a nice function in amiga.lib: HotKey() creates all three objects in one go.

Bye,
Thomas