Welcome, Guest. Please login or register.

Author Topic: commoditie + keys handler  (Read 977 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline kas1eTopic starter

commoditie + keys handler
« on: November 23, 2004, 03:44:10 PM »
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);

 // ??

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.


 

Offline Thomas

Re: commoditie + keys handler
« Reply #1 on: November 24, 2004, 10:52:53 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