LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Menu contextuel sur un String Controls

Bonjour,

J'utilise LabWindows depuis peu pour mon stage, et, pour le logiciel que je dois faire, j'aurais besoin d'avoir un menu contextuel pour plusieurs String Controls avec les fonctionnalités "Couper, Copier, Coller".
J'ai rechercher sur le forum, et je n'ai pas trouver de solution pour autant (J'ai peut-être mal chercher ^^')
Si l'un de vous a une idée de solution, je suis preneur 🙂

Merci d'avance pour votre aide.

Cordialement

0 Kudos
Message 1 of 2
(3,213 Views)

I normally do the following:

 

  1. Define a menu bar in the UIR editor the same as you'd do when you prepare a menu bar for a panel

  2. Load the menu bar in memory:
    menuH = LoadMenuBar (0, "myUIRfile.UIR", menuBarID);
    Without passing a panel handle to LoadMenuBar, the menu is loaded in memory but is not associated with any panel

  3. Use RunPopupMenu to display the context menu:
    int CVICALLBACK ControlCallback (int panel, int control, int event,
    		void *callbackData, int eventData1, int eventData2)
    {
    	if (event != EVENT_LEFT_CLICK && event != EVENT_RIGHT_CLICK) return 0;
    
    	RunPopupMenu (menuH, menuID, panel, eventData1, eventData2, 0, 0, 0, 0);
    
    	return 0;
    }
    With the code shown, the context menu is displayed on left and right clicks on the control, at the cursor position. It is assumed that all items in the menu bar have their proper callback function attached. Alternatively, you can trap the return value from the instruction and switch on it (do not forget in this case to handle case 0 which means the user has dismissed the menu without choosing any item, e.g. by pressing Esc key)

 

 

I am sorry to answer in English: I'm not a French native speaker, I hope Google translated correctly your question Smiley Wink

In the future it is preferable you write in English in this page, otherwise you can address your question to the French board



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 2
(3,193 Views)