LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

menu box selection/popup/return to one line

Solved!
Go to solution
I'm trying to program a control that allows a user to select from 7 different options. The options are mutually exclusive and collectively exhaustible (that is, exactly one must be chosen at all times). I've tried a menu box that begins with a single line visible (the line containing the currently selected choice). This is how I'd like it to work: - when the user clicks on the box, all 7 choices appear - the user moves the cursor over the desired selection and releases (or clicks again; I don't care) - the new selection "takes" - the box returns to one line displaying I have the first part working, but I can't find the right event(s) to do the rest. Am I on the right track? Any suggestions for making this work? Thanks.
0 Kudos
Message 1 of 11
(3,659 Views)
Solution
Accepted by topic author mzimmers

I agree that any type of ring control is a good choice, a suitable event is EVENT_VAL_CHANGED.

 

But I also would remind you that CVI comes with a large collection of sample programs, some of them also include ring controls. Analyzing those samples also helps to get acquainted with CVI.

Message 2 of 11
(3,656 Views)

Hi, Wolfgang --

 

You're right, the menu ring is a much preferred approach to the list box I was trying. 

 

I have it mostly working. The only problem I can see is, after a user makes a selection, the display doesn't update until he's moved the mouse. Oddly, this only happens in the real program (not when operating in the UIR editor).

 

Any ideas why this might be?

 

Thanks.

0 Kudos
Message 3 of 11
(3,642 Views)

Another question...is it possible to programmatically disable ("ghost") certain items in the menu? 

0 Kudos
Message 4 of 11
(3,633 Views)

SetRingItemAttribute  (, , , ATTR_DIMMED, );

Message 5 of 11
(3,627 Views)

Ah, OK. So I dim it with that, but handle the disabled selections myself? That would work.

 

I'm still trying to figure out why the EVENT_VAL_CHANGED case doesn't trigger until the user moves the mouse a few pixels after making his selection. If you have any ideas there, that'd be great.

0 Kudos
Message 6 of 11
(3,620 Views)

@mzimmers wrote:

I'm still trying to figure out why the EVENT_VAL_CHANGED case doesn't trigger until the user moves the mouse a few pixels after making his selection. If you have any ideas there, that'd be great.


It does work usually, so I would assume that it has to do with your code... Smiley Wink

You will need to debug it yourself as we don't know it.

 

Some suggestions: in the callback try to react to one type of event only; clone your project and remove all other callbacks except the ring control and its callback, particularly things like panel callbacks, extended mouse events or your TCP callback...

0 Kudos
Message 7 of 11
(3,614 Views)

Hey, Wolfgang -

 

Before I try your suggestion, do I understand that other callbacks could somehow be impeding the callback for the ring? I do have a timer CB that triggers several times a second. I'm trying to understand how this would cause me a problem, though. I suppose I could check for getting focus on the ring, and disabling the timer until I lose focus, or something like that.

0 Kudos
Message 8 of 11
(3,608 Views)

May be the first thing to try is to select the ring and then use your keyboard (up/down keys) to change the selection. This way you can be sure that the mouse has not been moved... 

0 Kudos
Message 9 of 11
(3,602 Views)

On your advice, I disabled the one CB that might have been interfering, and the ring works fine. The CB that I disabled does a lot of work, but I don't know enough about the overall CB mechanism to know how it might be blocking the ring.

 

I think in the morning, I'm going to replace all of my TCP calls with native WS2 operations. I'll see if that improves things, and report back.

0 Kudos
Message 10 of 11
(3,600 Views)