diff android/dw.cpp @ 2607:3b9bbd69bb9c

Android: Implement dw_menu_popup() ... still need to implement the context events.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 16 Jul 2021 02:58:43 +0000
parents 60ec91d23746
children a11522c30345
line wrap: on
line diff
--- a/android/dw.cpp	Thu Jul 15 21:22:59 2021 +0000
+++ b/android/dw.cpp	Fri Jul 16 02:58:43 2021 +0000
@@ -4651,6 +4651,20 @@
  */
 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
 {
+    JNIEnv *env;
+
+    if(menu && *menu && parent && (env = (JNIEnv *)pthread_getspecific(_dw_env_key)))
+    {
+        // First get the class that contains the method you need to call
+        jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
+        // Get the method that you want to call
+        jmethodID menuPopup = env->GetMethodID(clazz, "menuPopup",
+                                               "(Lorg/dbsoft/dwindows/DWMenu;Landroid/view/View;II)V");
+        // Call the method on the object
+        env->CallVoidMethod(_dw_obj, menuPopup, *menu, parent, x, y);
+        _dw_jni_check_exception(env);
+        *menu = nullptr;
+    }
 }
 
 char _dw_removetilde(char *dest, const char *src)