androidlcl: Minimal implementation of statictext, checkbox, edit and combobox

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1792 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-08-10 11:42:11 +00:00
parent ef44e19afb
commit b08f795fb4
5 changed files with 75 additions and 5 deletions

View File

@@ -90,6 +90,10 @@ public class AndroidAll
static final int amkUI_TCompoundButton_toggle = 0x00110003; static final int amkUI_TCompoundButton_toggle = 0x00110003;
// CheckBox // CheckBox
static final int amkUI_TCheckBox_Create = 0x00111000; static final int amkUI_TCheckBox_Create = 0x00111000;
// AdapterView
// AbsSpinner
// Spinner
static final int amkUI_TSpinner_Create = 0x00114000;
public boolean ProcessCommand(int Buffer) public boolean ProcessCommand(int Buffer)
{ {
@@ -369,12 +373,14 @@ public class AndroidAll
DebugOut("amkUI_TButton_Create"); DebugOut("amkUI_TButton_Create");
ViewElements.add(new Button(activity)); ViewElements.add(new Button(activity));
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1); MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
DebugOut("amkUI_TButton_Create Self=" + Integer.toString(ViewElements.size() - 1));
break; break;
// method void setText(CharSequence AText); override; // method void setText(CharSequence AText); override;
case amkUI_TButton_setText: case amkUI_TButton_setText:
DebugOut("amkUI_TButton_setText"); DebugOut("amkUI_TButton_setText");
// Self // Self
lInt = MyAndroidPipesComm.GetInt(); lInt = MyAndroidPipesComm.GetInt();
DebugOut("amkUI_TButton_setText Self=" + Integer.toString(lInt));
param_self_Button = (Button) ViewElements.get(lInt); param_self_Button = (Button) ViewElements.get(lInt);
// params // params
lInt = MyAndroidPipesComm.GetInt(); lInt = MyAndroidPipesComm.GetInt();
@@ -516,6 +522,11 @@ public class AndroidAll
ViewElements.add(new CheckBox(activity)); ViewElements.add(new CheckBox(activity));
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1); MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
break; break;
case amkUI_TSpinner_Create:
DebugOut("amkUI_TSpinner_Create");
ViewElements.add(new Spinner(activity));
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
break;
default: default:
return false; return false;

View File

@@ -56,6 +56,27 @@ public class AndroidPipesComm
Log.v("AndroidPipesComm:", Str); Log.v("AndroidPipesComm:", Str);
// tv.setText(tv.getText().toString() + Str); // tv.setText(tv.getText().toString() + Str);
} }
public void TerminateApplication()
{
System.exit(0);
}
public void PrintPascalException(byte Buffer)
{
String PascalMessage = "" + (char) Buffer;
try
{
while (true)
{
PascalMessage = PascalMessage + (char) reader.readByte();
}
}
catch (IOException e)
{
ErrorOut(PascalMessage);
}
}
// Waits for a particular Pascal message. // Waits for a particular Pascal message.
// In the mean time processes any other incoming messages // In the mean time processes any other incoming messages
@@ -118,11 +139,16 @@ public class AndroidPipesComm
else else
{ {
ErrorOut("Unknown Pascal message!!! " + java.lang.Integer.toHexString(Buffer)); ErrorOut("Unknown Pascal message!!! " + java.lang.Integer.toHexString(Buffer));
// If we get an Unknown Pascal message, it might be an error printed to the console, so lets print it and quit
PrintPascalException(Buffer);
TerminateApplication();
} }
} }
catch (EOFException e) catch (EOFException e)
{ {
ErrorOut("[WaitAndProcessPascalMessage] EOFException=" + e.getMessage()); ErrorOut("[WaitAndProcessPascalMessage] EOFException=" + e.getMessage());
TerminateApplication();
} }
catch (IOException e) catch (IOException e)
{ {
@@ -258,7 +284,7 @@ public class AndroidPipesComm
catch (IOException e) catch (IOException e)
{ {
ErrorOut("[SendMessage] IOException=" + e.getMessage()); ErrorOut("[SendMessage] IOException=" + e.getMessage());
System.exit(0); TerminateApplication();
} }
} }

View File

@@ -60,10 +60,6 @@
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration>
<TargetCPU Value="arm"/>
<TargetOS Value="linux"/>
</CodeGeneration>
<Linking> <Linking>
<Options> <Options>
<Win32> <Win32>

View File

@@ -15,4 +15,37 @@ object Form2: TForm2
Caption = 'Button1' Caption = 'Button1'
TabOrder = 0 TabOrder = 0
end end
object CheckBox1: TCheckBox
Left = 32
Height = 21
Top = 91
Width = 94
Caption = 'CheckBox1'
TabOrder = 1
end
object Edit1: TEdit
Left = 37
Height = 25
Top = 145
Width = 99
TabOrder = 2
Text = 'Edit1'
end
object StaticText1: TStaticText
Left = 147
Height = 17
Top = 36
Width = 65
Caption = 'StaticText1'
TabOrder = 3
end
object ComboBox1: TComboBox
Left = 151
Height = 27
Top = 84
Width = 100
ItemHeight = 0
TabOrder = 4
Text = 'ComboBox1'
end
end end

View File

@@ -14,6 +14,10 @@ type
TForm2 = class(TForm) TForm2 = class(TForm)
Button1: TButton; Button1: TButton;
CheckBox1: TCheckBox;
ComboBox1: TComboBox;
Edit1: TEdit;
StaticText1: TStaticText;
private private
{ private declarations } { private declarations }
public public