My MouseDown function below works as intended. It prints which button
that was clicked.
However the MouseUp function does not work.
It contains a “buttons” field, but it doesn’t printf anything.
Anyone know what’s wrong?
void View::MouseDown(BPoint point) {
int32 buttons;
if (Window()->CurrentMessage()->FindInt32("buttons", (int32 *)&buttons) == B_NO_ERROR) {
if (buttons & B_PRIMARY_MOUSE_BUTTON) {
printf("down pri");
}
if (buttons & B_SECONDARY_MOUSE_BUTTON) {
printf("down sec");
}
if (buttons & B_TERTIARY_MOUSE_BUTTON) {
printf("down ter");
}
}
}
void View::MouseUp(BPoint point) {
uint32 buttons;
if (Window()->CurrentMessage()->FindInt32("buttons", (int32 *)&buttons) == B_NO_ERROR) {
if (buttons & B_PRIMARY_MOUSE_BUTTON) {
printf("up pri");
}
if (buttons & B_SECONDARY_MOUSE_BUTTON) {
printf("up sec");
}
if (buttons & B_TERTIARY_MOUSE_BUTTON) {
printf("up ter");
}
}
}
My MouseDown function below works as intended. It prints which button
that was clicked.
However the MouseUp function does not work.
It contains a "buttons" field, but it doesn’t printf anything.
Does the MouseUp() function get called at all? My Be Developer’s Guide (printed, O’Reilly) says "This function is a placeholder for future releases; it isn’t currently called. Although B_MOUSE_UP messages are generated, a virtual function is not now called to handle them."
Granted it’s been a long time since I did some programming on BeOS, and the book was released around R4 or earlier…
There IS both a B_MOUSE_UP message in R5 and a MouseUp() hook in BView(that gets called).
There IS also a buttons field in the B_MOUSE_UP message, however this is
undocumented and &buttons is always 0.
I suppose this was not finished in R5.
I’m going to test with GetMouse() in MouseUp() as [Beta] said above.