Jump to content

Recommended Posts

I have a multicolumn listbox where I would like a "right-click" to set the value of the MC listbox to the row that was right-clicked, then a shortcut menu will appear. Depending on the value of the MC listbox (i.e. row clicked) I determine what right-click menu options are available. To do this, I use the mouse down event, and if it's a right click, I set the MC listbox value to the row clicked. Then, the shortcut menu activation event is fired, and in there I use the current value of the MC listbox to enable/disable menu items. My question is this, can I always expect the mouse down event to occur first (it seems it does), or do I need to manage the order in which the events fire. I guess I could also handle all this logic in the mouse down case, inside my case structure, when checking which button was pressed. What I want to make sure I avoid is the shortcut menu activation firing first and having the wrong row selected in the MC listbox which may disable/enable the wrong menu items.

Edit:

After discussing w/ co-workers, I think the answer is yes, because the mouse-down is the event, the shortcut menu activation is the system response to that event. Please let me know if this is wrong.

Edited by for(imstuck)
Link to comment

I agree with your conclusion. I don't think these can ever be out of order because LV has to recognize the click (Mouse Down) before it can react (Shortcut Menu).

Off topic, but shouldn't your username be while(imstuck)? Is imstuck iterable?

  • Like 1
Link to comment

If it keeps you up at night you could use the Mouse Down? filter event, but I also think that both events are handled before the short menu activiation. Furthermore, I have found that in situations like this the behavior is at least consistent, meaning that it either works or it doesn't. It sounds like it worked, so if it were me I would not worry that much about it.

Link to comment

Yes, those events will always come in the predictable order, as asbo postulated.

asbo: Never forget that "for" can be abused as "while" in a lot of C-like languages. Read it as "for(;imstuck;)" where imstuck is true. Semicolons would be needed in C++, but there are other similar languages where you wouldn't need them.

Link to comment

Yes, those events will always come in the predictable order, as asbo postulated.

asbo: Never forget that "for" can be abused as "while" in a lot of C-like languages. Read it as "for(;imstuck;)" where imstuck is true. Semicolons would be needed in C++, but there are other similar languages where you wouldn't need them.

Makes me wonder if we're allowed semicolons in our usernames...

:D ...although, this actually stops fairly quickly.

post-15770-0-08554900-1334330454.png

Edited by for(imstuck)
Link to comment
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.