Mercurial > dwindows
comparison android/dw.cpp @ 2515:211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
Still need to access the internal resource for the down arrow button.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 08 May 2021 01:15:54 +0000 |
parents | 5f711e86a211 |
children | d746323f2841 |
comparison
equal
deleted
inserted
replaced
2514:5f711e86a211 | 2515:211044d98e86 |
---|---|
1516 * handle: Handle to the listbox to be appended to. | 1516 * handle: Handle to the listbox to be appended to. |
1517 * text: Text to append into listbox. | 1517 * text: Text to append into listbox. |
1518 */ | 1518 */ |
1519 void API dw_listbox_append(HWND handle, const char *text) | 1519 void API dw_listbox_append(HWND handle, const char *text) |
1520 { | 1520 { |
1521 JNIEnv *env; | |
1522 | |
1523 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | |
1524 { | |
1525 // Construct a String | |
1526 jstring jstr = env->NewStringUTF(text); | |
1527 // First get the class that contains the method you need to call | |
1528 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | |
1529 // Get the method that you want to call | |
1530 jmethodID listOrComboBoxAppend = env->GetMethodID(clazz, "listOrComboBoxAppend", | |
1531 "(Landroid/view/View;Ljava/lang/String;)V"); | |
1532 // Call the method on the object | |
1533 env->CallVoidMethod(_dw_obj, listOrComboBoxAppend, handle, jstr); | |
1534 } | |
1521 } | 1535 } |
1522 | 1536 |
1523 /* | 1537 /* |
1524 * Inserts the specified text into the listbox's (or combobox) entry list. | 1538 * Inserts the specified text into the listbox's (or combobox) entry list. |
1525 * Parameters: | 1539 * Parameters: |
1650 * Returns: | 1664 * Returns: |
1651 * A handle to a combobox window or NULL on failure. | 1665 * A handle to a combobox window or NULL on failure. |
1652 */ | 1666 */ |
1653 HWND API dw_combobox_new(const char *text, ULONG cid) | 1667 HWND API dw_combobox_new(const char *text, ULONG cid) |
1654 { | 1668 { |
1669 JNIEnv *env; | |
1670 | |
1671 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | |
1672 { | |
1673 // Construct a String | |
1674 jstring jstr = env->NewStringUTF(text); | |
1675 // First get the class that contains the method you need to call | |
1676 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | |
1677 // Get the method that you want to call | |
1678 jmethodID comboBoxNew = env->GetMethodID(clazz, "comboBoxNew", | |
1679 "(Ljava/lang/String;I)Lorg/dbsoft/dwindows/DWComboBox;"); | |
1680 // Call the method on the object | |
1681 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, comboBoxNew, jstr, (int)cid)); | |
1682 return result; | |
1683 } | |
1655 return 0; | 1684 return 0; |
1656 } | 1685 } |
1657 | 1686 |
1658 /* | 1687 /* |
1659 * Create a new Multiline Editbox window (widget) to be packed. | 1688 * Create a new Multiline Editbox window (widget) to be packed. |