Spectre5000
April 19th, 2001, 02:24 PM
I have a really strange thing happening, and was wondering if anyone knows how to solve this. I have a Visual J++ program that I am working on, and I have nailed down the procedure to check for right vs left mouse button. When I click the right mouse button, a popup menu comes up. Now, I have it set so when this menu comes up, the menu comes up where the mouse cursor is. The first time I right click, the menu works fine. But if I move the mouse and right click again, the menu comes up at the bottom of the screen. I have tried reversing my logic (I will enclose the check) to test this with the left mouse button, and the left mouse button works fine with the menu. It always comes up where the mouse is positioned. Anyone know what I am doing wrong? Is it just my pc? Thanks!
private void Form2_mouseDown(Object source, MouseEvent e)
{
int Mouse = e.button;
Integer MyMouse = new Integer(Mouse);
String MouseHex = MyMouse.toHexString(e.button);
String MouseL = "100000";
Context.clear();
Context.dispose();
if (MouseHex.compareTo(MouseL) == 0)
{
which = true;
}
else
{
Pnt.x = e.x;
Pnt.y = e.y;
which = false;
}
}
public void ContextMenu()
{
Edit[0] = Cut.cloneMenu();
Edit[1] = menuItem3.cloneMenu();
Edit[2] = menuItem4.cloneMenu();
Edit[3] = menuItem5.cloneMenu();
for (int i = 0; i < 4; i++)
{
Context.add(Edit[i]);
}
Context.show(MSFlexGrid1, Pnt);
}
private void MSFlexGrid1_click(Object source, Event e)
{
if (which == false)
{
ContextMenu();
}
}
In the above, it is set to the right mouse button. However, when I change the operator in the compareTo statement to something other than ==, it is the left mouse button. Any help here would be hot.
private void Form2_mouseDown(Object source, MouseEvent e)
{
int Mouse = e.button;
Integer MyMouse = new Integer(Mouse);
String MouseHex = MyMouse.toHexString(e.button);
String MouseL = "100000";
Context.clear();
Context.dispose();
if (MouseHex.compareTo(MouseL) == 0)
{
which = true;
}
else
{
Pnt.x = e.x;
Pnt.y = e.y;
which = false;
}
}
public void ContextMenu()
{
Edit[0] = Cut.cloneMenu();
Edit[1] = menuItem3.cloneMenu();
Edit[2] = menuItem4.cloneMenu();
Edit[3] = menuItem5.cloneMenu();
for (int i = 0; i < 4; i++)
{
Context.add(Edit[i]);
}
Context.show(MSFlexGrid1, Pnt);
}
private void MSFlexGrid1_click(Object source, Event e)
{
if (which == false)
{
ContextMenu();
}
}
In the above, it is set to the right mouse button. However, when I change the operator in the compareTo statement to something other than ==, it is the left mouse button. Any help here would be hot.