LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to differentiate between a control event right_click and a panel event right_click

All my controls have a MessagePopup under event RIGHT_CLICK to help the user understand the use of that control.

I also have a MessagePopup under my panel under event RIGHT _CLICK to help the user understand the operation of that panel.

When the user right clicks on the control, BOTH control AND panel popups appear.

How do I avoid poping up the Panel message, when just the control is wanted?

0 Kudos
Message 1 of 11
(3,672 Views)

The callbacks could swallow the event by returning 1. Instead of return (0) use return (1), that should do the trick.

0 Kudos
Message 2 of 11
(3,671 Views)

Thank you very much, that worked!!

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

An alternative could be to use tooltips to display control help: while loading a panel you can use SetCtrlToolTipAttribute (..., ..., CTRL_TOOLTIP_ATTR_TEXT, ...); to install a tooltip on all relevant controls. With this option you can avoid the use of right click and consequent Ok button to close the popup message, that you can leave active for the panel only (unless you want to add a control -e.g. a button with a question mark- and install a tooltip on it to display panel help).



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 11
(3,665 Views)

I only have 1 panel, but over 100 controls. I see that you mentioned..."to display control help: while loading a panel you can use SetCtrlToolTipAttribute (..., ..., CTRL_TOOLTIP_ATTR_TEXT, ...);"   I have just as many different MessagePopup texts as controls.

How does loading 1 panel with the CTRL_TOOLTIP_ATTR_TEXT option affect several different controls?

It would be nice if the user didnt have to click OK every time a popup pops up. Mind you, some of this text is verbose, long, others are short, so a time delay would not be advisable since they would equire different duration for each. Maybe a "mouse over" over the popup would be really nice. Since you seem to be experienced in this, what do you recommend?

0 Kudos
Message 5 of 11
(3,661 Views)

Tooltips may be more convenient because they appear (and disappear) automatically, no user interaction needed.

 

In CVI you can create tool tips using the Programmer’s Toolbox, i.e. the function SetCtrlToolTipAttribute().

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

Tooltips are a control extension, so you need to install them on each control you require a help test to be displayed.

 

With so many controls over a panel, you could format an array of strings with help texts and an array of control IDs, next iterate on the arrays in a loop that should be quite fast.

Something on this line:

 

    int     i;

    int     ctlID[] = { PANEL_CONTROL1, PANEL_CONTROL2, PANEL_CONTROL3, PANEL_CONTROL4, PANEL_CONTROL5 };
    char    strings[][15] = { "Tooltip help 1", "Tooltip help 2", "Tooltip help 3", "Tooltip help 4", "Tooltip help 5" };


    for (i = 0; i < 5; i++)

         SetCtrlToolTipAttribute (anagH, ctlID[i], CTRL_TOOLTIP_ATTR_TEXT, strings[i]);



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 7 of 11
(3,631 Views)

thank you for the example.

I guess this would be something to do during the design stage of the program.

The program is finished(meaning running) has about 10K SLOC and I'm making it "pretty" by (what I thought was nice) MessagePopups on event RIGHT_CLICK for user help.

Obviously, changing to yuor good suggestion at this point would require almost a quite large addition to the existing program.

It is a nice idea, 1 which i hadn't come across due to my lack of internal knowledge of CVI and Windows messaging, but certainly 1 to study for the next project and incorporate it at design time.

If I understand your example correctly, the 2 arrays you have shown me would be as large as the # of controls, am I correct?

For the time being I think the fastest way to fix my problem would be to change Return 0 to Return 1 whereever a MessagePopup exists.

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

I have justed focused on you question about tooltip duration or hovering the mouse over a control.

What you are asking for is apparently a little addition ot the tooltip functions already included in the Programmer's Toolbox. Nevertheless, despite the fact that toolbox source code is distributed together with CVI, modifying it can be not so simple as the whole tooltip matter involves almost 20 base functions whith calls to other inner functions and a bunch of structures and variables: it may be too complicated to modify it, even more considering that modifying the toolbox implies that you transfer your modifications on every new cvi release you install on your system...

 

It seems simpler to me leaving the tooltip as it is and have the user move the mouse off and on a control to display it again.



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 9 of 11
(3,623 Views)

Hbru ha scritto:

thank you for the example.

I guess this would be something to do during the design stage of the program.

The program is finished(meaning running) has about 10K SLOC and I'm making it "pretty" by (what I thought was nice) MessagePopups on event RIGHT_CLICK for user help.

Obviously, changing to yuor good suggestion at this point would require almost a quite large addition to the existing program.

It is a nice idea, 1 which i hadn't come across due to my lack of internal knowledge of CVI and Windows messaging, but certainly 1 to study for the next project and incorporate it at design time.

If I understand your example correctly, the 2 arrays you have shown me would be as large as the # of controls, am I correct?

For the time being I think the fastest way to fix my problem would be to change Return 0 to Return 1 whereever a MessagePopup exists.


I understand your thoughts and agree with you that modifying a finished application is not a feasible solution.

I am glad I have pointed you to some unknown function that may help you in the future.

 



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 10 of 11
(3,621 Views)