Android example: Adds a TCustomControl, removes unnecessary calling cdecl option and removes support for nativeapp

git-svn-id: trunk@33825 -
This commit is contained in:
sekelsenmat 2011-11-28 12:31:32 +00:00
parent 18fff55534
commit 4391554b46
4 changed files with 30 additions and 9 deletions

View File

@ -89,7 +89,7 @@
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CustomOptions Value="-dANDROID -Xd -Cccdecl"/>
<CustomOptions Value="-dANDROID -Xd"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>

View File

@ -6,20 +6,13 @@ library androidlcltest;
uses
{$ifdef Android}
cmem,
{$ifdef CD_Android_NativeApp}
android_native_app_glue,
{$else}
customdrawnint,
{$endif}
{$endif}
Interfaces,
Forms,
mainform;
{$ifdef CD_Android_NativeApp}
exports //android_main name 'android_main',
ANativeActivity_onCreate name 'ANativeActivity_onCreate';
{$else}
{$ifdef Android}
exports
Java_com_pascal_lclproject_LCLActivity_stringFromJNI name 'Java_com_pascal_lcltest_LCLActivity_stringFromJNI',
Java_com_pascal_lclproject_LCLActivity_intFromJNI name 'Java_com_pascal_lcltest_LCLActivity_intFromJNI',

View File

@ -4,6 +4,7 @@ object Form1: TForm1
Top = 186
Width = 320
Caption = 'Form1'
OnCreate = FormCreate
OnPaint = FormPaint
LCLVersion = '0.9.31'
end

View File

@ -9,14 +9,23 @@ uses
type
{ TSubControl }
TSubControl = class(TCustomControl)
public
procedure Paint; override;
end;
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
SubControl: TSubControl;
end;
var
@ -24,10 +33,28 @@ var
implementation
{ TSubControl }
procedure TSubControl.Paint;
begin
Canvas.Brush.Color := clBlue;
Canvas.Rectangle(0, 0, Width, Height);
end;
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
SubControl := TSubControl.Create(Self);
SubControl.Left := 100;
SubControl.Top := 100;
SubControl.Width := 100;
SubControl.Height := 100;
SubControl.Parent := Self;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Brush.Color := clRed;