Skip to main content

I need to capture the mouse button in a ListBox, done that

method-id listBox2_MouseClick final private.

procedure division using by value sender as object e as type System.Windows.Forms.MouseEventArgs.

if (e::Button = type MouseButtons::Right)

invoke type MessageBox::Show("Direito" "MMSIS")

end-if

if (e::Button = type MouseButtons::Left)

invoke type MessageBox::Show("Esquerda" "MMSIS")

end-if

if (e::Button = type MouseButtons::Middle)

invoke type MessageBox::Show("Centro" "MMSIS")

end-if

end method.

But just take the left button

I need to capture the mouse button in a ListBox, done that

method-id listBox2_MouseClick final private.

procedure division using by value sender as object e as type System.Windows.Forms.MouseEventArgs.

if (e::Button = type MouseButtons::Right)

invoke type MessageBox::Show("Direito" "MMSIS")

end-if

if (e::Button = type MouseButtons::Left)

invoke type MessageBox::Show("Esquerda" "MMSIS")

end-if

if (e::Button = type MouseButtons::Middle)

invoke type MessageBox::Show("Centro" "MMSIS")

end-if

end method.

But just take the left button

Use o método  MouseDown que irá funcionar.

Use the MouseDown method that will work.


I need to capture the mouse button in a ListBox, done that

method-id listBox2_MouseClick final private.

procedure division using by value sender as object e as type System.Windows.Forms.MouseEventArgs.

if (e::Button = type MouseButtons::Right)

invoke type MessageBox::Show("Direito" "MMSIS")

end-if

if (e::Button = type MouseButtons::Left)

invoke type MessageBox::Show("Esquerda" "MMSIS")

end-if

if (e::Button = type MouseButtons::Middle)

invoke type MessageBox::Show("Centro" "MMSIS")

end-if

end method.

But just take the left button

Obrigado Altair, então era só o evento que estava erra, valeu!