Mercurial > dwindows
diff android/dw.cpp @ 2689:7127de139acf
Android: Implement groupbox using RadioGroup... still missing the title and
visible border seen on most other platforms, but it works for making sure
radiobuttons contained inside only have one selected.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 28 Oct 2021 17:27:59 +0000 |
parents | 42ff9d95e87b |
children | cee79add3669 |
line wrap: on
line diff
--- a/android/dw.cpp Thu Oct 28 00:22:42 2021 +0000 +++ b/android/dw.cpp Thu Oct 28 17:27:59 2021 +0000 @@ -1370,8 +1370,22 @@ */ HWND API dw_groupbox_new(int type, int pad, const char *title) { - /* TODO: Just create a normal box for now */ - return dw_box_new(type, pad); + JNIEnv *env; + + if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) + { + // Construct a String + jstring jstr = title ? env->NewStringUTF(title) : nullptr; + // 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 groupBoxNew = env->GetMethodID(clazz, "groupBoxNew", + "(IILjava/lang/String;)Landroid/widget/LinearLayout;"); + // Call the method on the object + jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, groupBoxNew, type, pad, jstr), _DW_REFERENCE_WEAK); + return result; + } + return nullptr; } /*