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?
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.