mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-15 19:09:35 +02:00
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:
parent
18fff55534
commit
4391554b46
@ -89,7 +89,7 @@
|
||||
<CompilerMessages>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<CustomOptions Value="-dANDROID -Xd -Cccdecl"/>
|
||||
<CustomOptions Value="-dANDROID -Xd"/>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
|
@ -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',
|
||||
|
@ -4,6 +4,7 @@ object Form1: TForm1
|
||||
Top = 186
|
||||
Width = 320
|
||||
Caption = 'Form1'
|
||||
OnCreate = FormCreate
|
||||
OnPaint = FormPaint
|
||||
LCLVersion = '0.9.31'
|
||||
end
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user