Menu opcji

Sprawy związane z interfejsem użytkownika - kontrolki, wskaźniki, wyświetlacze, wykresy oraz inne zagadnienia tego typu...
Slawek_ZG
Posty: 77
Rejestracja: 29 sty 2004 00:00

Menu opcji

Post autor: Slawek_ZG »

Witam WSZYSTKICH

Szukam informacji jak stworzyc wlasne menu pod prawy klawisz myszki (analogicznie jak w przypadku np. ARRARY gdzie prawy klawisz uaktywnia menu opcji tablicy).

Jesli ktos wie jak zrobic wlasne meny z checia skorzystam z tej wiedzy.

Pozdrawiam
Slawek
bogdani
Administrator
Posty: 1315
Rejestracja: 30 lip 2003 00:00
Wersja środowiska: LabVIEW 2015
Lokalizacja: Ruda Śląska
Kontakt:

Popup menu

Post autor: bogdani »

Witam
Musze przyznać, iż osobiście jeszcze nie miałem potrzeby robienia właśnego menu. Aczkolwiek temat ten trochę mnie zainteresował. Poszukałem trochę w sieci i niestety nie znalazłem zbyt wiele, ale może to coś pomoże (choć pewnie sam też do tego doszedłeś).
Znalazłem taką wypowiedź:

Kod: Zaznacz cały

 Hi,
 I have created a VI that uses the Win32 API functions to display a popup meu on a VI's front panel.
This isn't a decorated text box filled, showed and hidden with a property node, but a real windows system popup menu.

Anybody want to test it out?
I'd appreciate any feedback, fixes or

better implementations.
 The VI uses several sub VIs encapsulate the API calls for convenience, error checking and appearance.
 CreatePopupMenu is used to get a menu handle to a new empty menu structure.
AppendMenu is called with the MF_BYPOSITION and MF_STRING constants to add menu items from a string array.
TrackPopupMenu is called with the menu handle, a window handle (FindWindow gets the window handle), and the default flags for menu tracking.
DestroyMenu is called to reclaim resources used by the menu.
 I have used sub VIs and the DLL from the Windows Messageing Queue llb available on the Developer Zone.
I have used several other handy API calls to convert screen coordinates to client window coordinates using both POINTs and RECTs, etc.
 Hope y'all find this stuff useful, and if you get it to work on an NT or 2000 machine, let me know.
If it doesn't work, let me know that too.
I can tote a cussin' with the best of them. John Wilson Sanders Engineering & Analytical Services, Inc. Mobile, AL 251-633-4120 johnwilson@pctechnician.net 
Jest to jakaś metoda, więc poszukałem w tym kierunku i znalazłem to: Windows Message Queue Library
Windows API Function Utilities (32-bit) for LabVIEW

Tutaj jest kilka plików dotyczących menu, którychniestety nie sprawdzałem: FAVIs UI Programming Category
No i w końcu znalazłem też coś takiego: A Simple Demo for a Pop-up Menu
Mam nadzieję że wniosłem coś nowego. Jak czas pozwoli to zajmę się niedługo tym tematem.
bogdani
Ktoś ci pomógł na forum? Podziękuj dając pochwałę.

Obrazek Obrazek Obrazek
bogdani
Administrator
Posty: 1315
Rejestracja: 30 lip 2003 00:00
Wersja środowiska: LabVIEW 2015
Lokalizacja: Ruda Śląska
Kontakt:

Coś jeszcze znalazłem

Post autor: bogdani »

Poszukując dalej informacji w tym kierunku znalazłem nieco dokładniejszy przepis na zrobienie własnego popup menu

Kod: Zaznacz cały

 All Windows popup functionallity you need is found in the user32.dll in the winntsystem32 folder. Use the Call Library Function in LabVIEW to call it. The descriptions of the functions is found in the MSDN online:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_api_reference.asp
You are intressed in the "Menu" category and I would guess you need the following functions:
CreatePopupMenu - Creates the menu AppendMenu - Adds item to the menu TrackPopupMenu - Popups the menu and waits for a menu item to be selected DestroyMenu - Destroys the menu EnableMenuItem - Controls if an item is enabled or disabled
You might also need some functions to get the Window of the VI fronpanel (else you do not know where to popup the menu). These functions are found in the "Window" category.
FindWindow - finds the Window pointer of a VI frontpanel ClientToScreen - some coordiate transformations
The flags definitions and their numeric values are found in the "windows.h" file (search on the web).
Hope this help. Unfortunatly I do not have any LabVIEW code examples, but this is the way to to it (in Windows anyway).
Best regards,
Mattias Ericsson Endevo Gothenburg, Sweden http://www.endevo.se 
Myśle że to pozwoli na stworzenie VI, który to będzie robił łatwo i przyjemnie.
bogdani
Ktoś ci pomógł na forum? Podziękuj dając pochwałę.

Obrazek Obrazek Obrazek
bogdani
Administrator
Posty: 1315
Rejestracja: 30 lip 2003 00:00
Wersja środowiska: LabVIEW 2015
Lokalizacja: Ruda Śląska
Kontakt:

Popup menu

Post autor: bogdani »

Poruszyłem temat popup menu na forum LAVA i tam Michael Aivaliotis znalazł ciekawe rozwiązanie, nie korzystające z Win32 API
Szczegóły znajdziecie tutaj: http://forums.lavausergroup.org/index.php?showtopic=345
bogdani
Ktoś ci pomógł na forum? Podziękuj dając pochwałę.

Obrazek Obrazek Obrazek
bogdani
Administrator
Posty: 1315
Rejestracja: 30 lip 2003 00:00
Wersja środowiska: LabVIEW 2015
Lokalizacja: Ruda Śląska
Kontakt:

Nowe rozwiązanie

Post autor: bogdani »

Witam
Pojawiło się nowe rozwiązanie rozwiązujące problem menu podręcznego. Dostępne w naszym serwisie: PopUp menu.
bogdani
Ktoś ci pomógł na forum? Podziękuj dając pochwałę.

Obrazek Obrazek Obrazek
ODPOWIEDZ