Left-click, right-click

I have a listbox in which I want to read right-clicks and left-clicks to do different things. For instance, in some cells a right-click gives me a contextual menu while the left-click merely makes the cell editable.

My problem occurs when I left-click on it first then, while editable right-click. The dropdown menu appears but when I select from it that hititem doesn’t do anything. If I’m debugging, however, sometimes (maybe every time, hard to tell) it works … perhaps because entering the debugger changes things.

One more thing before I let you go: why does the constructcontextualmenu event not give me a row and column? I’m forced to calculate these as I’m doing it now. Is there a way I can know the row/column from a contextual click (right-click) in this event?

Windows 10, btw.

it is up to you to decide what a “left” or “right” click does.

if there is a contextual menu attached… the right click will automatically open it

the menu is for the CONTROL level… it is up to you if you want to drill down based on where within the control the user clicked

I’m able to get the menu. But if I’ve first left-clicked the cell and made it editable, right-clicking brings up the menu, allows me to select, but doesn’t extract my selection somehow. It’s mystifying.

Okay, I’m going to record this for posterity’s sake. I found a workaround to my listbox left-click/right-click issue. Here 'tis.

Problem: Left-clicking on a listbox cell and setting that cell’s type to TypeEditable results in an active, editable cell. Fine. But then right-clicking on that cell, creating a contextual menu, then selecting from it results in … nothing changed.

Solution: At the right-click event, set the focus to something other than that listbox.

Works for me.