From 5eaf24e65196178657264e17e023b8edb02822aa Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Fri, 19 Aug 2011 10:55:53 +0000 Subject: [PATCH] androidlcl: Binding update git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1810 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../src/com/pascal/androidlcl/AndroidAll.java | 57 +++++++++++++++++++ examples/androidlcl/mainform.lfm | 17 ++++-- 2 files changed, 68 insertions(+), 6 deletions(-) diff --git a/examples/androidlcl/android/src/com/pascal/androidlcl/AndroidAll.java b/examples/androidlcl/android/src/com/pascal/androidlcl/AndroidAll.java index dac38b899..1e21b6b76 100644 --- a/examples/androidlcl/android/src/com/pascal/androidlcl/AndroidAll.java +++ b/examples/androidlcl/android/src/com/pascal/androidlcl/AndroidAll.java @@ -92,8 +92,18 @@ public class AndroidAll static final int amkUI_TCheckBox_Create = 0x00111000; // AdapterView // AbsSpinner + static final int amkUI_TAbsSpinner_getCount = 0x00113000; + static final int amkUI_TAbsSpinner_setAdapter = 0x00113001; // Spinner static final int amkUI_TSpinner_Create = 0x00114000; + // Filterable + // Adapter + // ListAdapter + // SpinnerAdapter + // BaseAdapter + // ArrayAdapter + static final int amkUI_TArrayAdapter_String__Create = 0x0011A000; + static final int amkUI_TArrayAdapter_String__add = 0x0011A001; public boolean ProcessCommand(int Buffer) { @@ -114,10 +124,14 @@ public class AndroidAll DisplayMetrics param_self_DisplayMetrics; CompoundButton param_self_CompoundButton; WindowManager param_self_WindowManager; + AbsSpinner param_self_AbsSpinner; + ArrayAdapter param_self_ArrayAdapter_String_; // Params ViewGroup.LayoutParams lViewGroup_LayoutParams_1, lViewGroup_LayoutParams_2; + SpinnerAdapter lSpinnerAdapter_1; DisplayMetrics lDisplayMetrics_1; CharSequence lCharSequence_1; + String lString_1; View lView_1; int lint_1, lint_2, lint_3, lint_4; float lfloat_1, lfloat_2; @@ -546,11 +560,54 @@ public class AndroidAll ViewElements.add(new CheckBox(activity)); MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1); break; + // method int getCount() + case amkUI_TAbsSpinner_getCount: + DebugOut("amkUI_TAbsSpinner_getCount"); + // Self + lInt = MyAndroidPipesComm.GetInt(); + param_self_AbsSpinner = (AbsSpinner) ViewElements.get(lInt); + // params + // + lResult_int = param_self_AbsSpinner.getCount(); + MyAndroidPipesComm.SendIntResult(lResult_int); + break; + // method void setAdapter(SpinnerAdapter adapter) + case amkUI_TAbsSpinner_setAdapter: + DebugOut("amkUI_TAbsSpinner_setAdapter"); + // Self + lInt = MyAndroidPipesComm.GetInt(); + param_self_AbsSpinner = (AbsSpinner) ViewElements.get(lInt); + // params + lInt = MyAndroidPipesComm.GetInt(); + lSpinnerAdapter_1 = (SpinnerAdapter) ViewElements.get(lInt); + // + param_self_AbsSpinner.setAdapter(lSpinnerAdapter_1); + MyAndroidPipesComm.SendResult(); + break; case amkUI_TSpinner_Create: DebugOut("amkUI_TSpinner_Create"); ViewElements.add(new Spinner(activity)); MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1); break; + case amkUI_TArrayAdapter_String__Create: + DebugOut("amkUI_TArrayAdapter_String__Create"); + lint_1 = MyAndroidPipesComm.GetInt(); + ViewElements.add(new ArrayAdapter(activity, lint_1)); + MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1); + break; + // method void add(String aobject) + case amkUI_TArrayAdapter_String__add: + DebugOut("amkUI_TArrayAdapter_String__add"); + // Self + lInt = MyAndroidPipesComm.GetInt(); + param_self_ArrayAdapter_String_ = (ArrayAdapter) ViewElements.get(lInt); + // params + lInt = MyAndroidPipesComm.GetInt(); + lString_1 = (String) MyJavaLang.LangElements.get(lInt); + // + param_self_ArrayAdapter_String_.add(lString_1); + MyAndroidPipesComm.SendResult(); + break; default: return false; diff --git a/examples/androidlcl/mainform.lfm b/examples/androidlcl/mainform.lfm index 728a0e5b4..84429bb42 100644 --- a/examples/androidlcl/mainform.lfm +++ b/examples/androidlcl/mainform.lfm @@ -1,7 +1,7 @@ object Form2: TForm2 - Left = 313 + Left = 181 Height = 240 - Top = 186 + Top = 137 Width = 320 Caption = 'Form2' ClientHeight = 240 @@ -16,17 +16,17 @@ object Form2: TForm2 TabOrder = 0 end object CheckBox1: TCheckBox - Left = 32 + Left = 33 Height = 21 - Top = 91 + Top = 88 Width = 94 Caption = 'CheckBox1' TabOrder = 1 end object Edit1: TEdit - Left = 37 + Left = 33 Height = 25 - Top = 145 + Top = 144 Width = 99 TabOrder = 2 Text = 'Edit1' @@ -45,6 +45,11 @@ object Form2: TForm2 Top = 88 Width = 112 ItemHeight = 0 + Items.Strings = ( + 'Item1' + 'Item2' + 'Item3' + ) TabOrder = 4 Text = 'ComboBox1' end