Hi,
I experience some strange phenomenon when trying to create a CxFilter object. Especially when "rawmouse" is used, in which case it sets the error to 'BADFILTER'.
Here is a little proggy I cobbled up to demonstrate the issue:
#include <proto/exec.h> #include <proto/dos.h> #include <proto/commodities.h> CONST_STRPTR FD[] = {"rawmouse leftbutton" ,"rawmouse rightbutton" ,"rawmouse midbutton" ,"rawmouse relativemouse" ,"shift -alt -control a" ,"rawkey lshift alt f2" ,"rawkey control esc" , NULL }; int main(int argc, char *argv[]) { int RetVal = 9; CxObj *CO; int32 CxErr; uint16 i = 0; while (FD[i] != NULL) { CO = CxFilter(FD[i]); if (CO != NULL) { CxErr = ICommodities->CxObjError(CO); IDOS->Printf("Error : %ld -- %s\n", CxErr, FD[i]); ICommodities->ClearCxObjError(CO); CxErr = 0; ICommodities->DeleteCxObj(CO); } i++; } return RetVal; }
On the console i get this output:
Error : 4 -- rawmouse leftbutton Error : 4 -- rawmouse rightbutton Error : 4 -- rawmouse midbutton Error : 4 -- rawmouse relativemouse Error : 0 -- shift -alt -control a Error : 0 -- rawkey lshift alt f2 Error : 0 -- rawkey control esc
Anything related to "rawmouse" produces an error.
N.b. '-lauto' switch is used for compilation.
Do I overlook something?
Btw.: I've even taken one of the examples from Amiga wiki, made it compileable, and it produces the same error.
OldFart
After a reply I got from xenic at another forum it appears that some keywords are ill-documented: "leftbutton" should be "mouse_leftpress", "rightbutton" should be "mouse_rightpress" and "midbutton" should be "mouse_middlepress".
Problem seems solved.
OldFart
@lurkers
It is HERE where all the fun is happening. Come in and join the party!
OldFart
Just out of interest what happens if you try "rawkey leftbutton" instead? :-
@hypex
Unless leftbutton was in the Commodities library documentation WIKI and has been removed it's not listed as a valid qualifier for OS4. It's listed in the commodities library section of the OS3 Workbench book but some OS3 documentation doesn't apply to OS4 anymore. I do think the WIKI could lead to a little confusion over what you can use when creating a hotkey with the CxFilter() function and what you can use in a CxCustom() object. I think the old OS3 Workbench manual states that a hotkey consists of a qualifier and keyboard key; which appears to be true. Even though CxFilter() didn't produce an error in Oldfarts tests, my testing indicates that using a qualifier alone in CxFilter() doesn't actually work.
X1000 - OS 4.1FE
Using a qualifier alone does not make any sense.
The CxFilter object filters input events. An input event consists (among others) of a class, a code and a qualifier. Class and code describe the cause of the input event, qualifier is only an attribute. So you always have to specify a class and a code. The qualifier is an optional additional filter criteria.