LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Hide/Show Table Control Popup Possible?

Hello Fellow CVI Enthusiasts:

I have a table which is currently setup such that a user can click on either the ROW LABEL or COLUMN LABEL to select the entire row or column respectively. When they do one or the other with a right click, a Popup appears with the standard options of "FIND, GOTO and SORT." This is fine, but I would like to disable or hide certain functions depending upon whether a ROW was selected or a COLUMN was selected.

In another words, here is what I'd like to do.
1) User selects and highlights ROW 5 with the LEFT CLICK, and then immediately right clicks. I want a popup showing "SORT and FIND" only ... for example.

2)User selects and highlights COLUMN 1 with the LEFT CLICK, and then immediately right cli
cks. I want a popup showing "FIND and GOTO" ONLY ... for example.

3) Depending upon where the sequence is in my particular code, I want to disable or hide ANY popups for COLUMNS ONLY, but let popups such as (FIND, SORT, and GOTO) to be displayed when a user left clicks on a ROW only.

Can these things be done?

Thanks in Advance!!
0 Kudos
Message 1 of 5
(3,356 Views)
You can enable or disable the popup menu by using the ATTR_ENABLE_POPUP_MENU attribute in SetCtrlAttribute. I think there is no option to enable or disable individual items on the built-in popup menu.

An alternative approach could be to disable the built-in popup menu and create your own popup menu with RunPopupMenu on the EVENT_RIGHT_CLICK event in the table callback, disabling its items based on the position of the mouse (eventData parameters) to discriminate if it's on a row or column label.
You could use also GetTableCellFromPoint (panel, control, MakePoint (eventData2, eventData1), &cell);
but this function returns (0,0) if you click outside the data area (that is, even if you click on a row or column label), so you still will have to struggle wi
th x and y coordinates.
Inside your program you can decide whether to enable some (or all) popups or not.

Hope this helps
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 5
(3,356 Views)
Roberto,

You can enable/disable individual items using the HideBuiltInCtrlMenuItem and ShowBuiltInCtrlMenuItem functions. You can also add your own items using the NewCtrlMenuItem and NewCtrlMenuSeparator functions.

Luis Gomes
NI
0 Kudos
Message 3 of 5
(3,356 Views)
Thank you very much, Luis.
There's so much to learn and so few time to study it...

Just to deep a little into this new (for me!) feature: in case you have to add several items to the menu and perhaps hide some of the buit-in features, do you think it's faster to modify the built-in menu or to create a new one in the UIR editor and load with the RunPopupMenu? Are there other negative hints in using a proprietary menu instead of the bult-in one?

Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(3,356 Views)
In terms of performance, it's essentially the same.
But if you don't need to use any of the built-in features, then you're probably better off using your own menu, since you have more control of where and when the menu appears. There's no downside, really, other than not having the built-in functions.

- luis
0 Kudos
Message 5 of 5
(3,356 Views)