mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 10:59:29 +02:00
lcl: added lclversion unit and example (#10250)
git-svn-id: trunk@13156 -
This commit is contained in:
parent
c69fef99dc
commit
bd8a102149
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -1644,6 +1644,11 @@ examples/lazintfimage/fadein1.lpr svneol=native#text/pascal
|
||||
examples/lazintfimage/mainunit1.lfm svneol=native#text/plain
|
||||
examples/lazintfimage/mainunit1.lrs svneol=native#text/pascal
|
||||
examples/lazintfimage/mainunit1.pas svneol=native#text/pascal
|
||||
examples/lclversion/lclversionexample.lpi svneol=native#text/plain
|
||||
examples/lclversion/lclversionexample.lpr svneol=native#text/plain
|
||||
examples/lclversion/unit1.lfm svneol=native#text/plain
|
||||
examples/lclversion/unit1.lrs svneol=native#text/plain
|
||||
examples/lclversion/unit1.pas svneol=native#text/plain
|
||||
examples/listboxtest.lpi svneol=native#text/plain
|
||||
examples/listboxtest.pp svneol=native#text/pascal
|
||||
examples/listview/listview.lpi svneol=native#text/plain
|
||||
@ -3180,6 +3185,7 @@ lcl/lclproc.pas svneol=native#text/pascal
|
||||
lcl/lclrescache.pas svneol=native#text/pascal
|
||||
lcl/lclstrconsts.pas svneol=native#text/pascal
|
||||
lcl/lcltype.pp svneol=native#text/pascal
|
||||
lcl/lclversion.pas svneol=native#text/plain
|
||||
lcl/lconv.pas svneol=native#text/plain
|
||||
lcl/ldockctrl.pas svneol=native#text/plain
|
||||
lcl/ldockctrledit.lfm svneol=native#text/plain
|
||||
|
65
examples/lclversion/lclversionexample.lpi
Normal file
65
examples/lclversion/lclversionexample.lpi
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="6"/>
|
||||
<General>
|
||||
<SessionStorage Value="InIDEConfig"/>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<Title Value="lclversionexample"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="lclversionexample.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="lclversionexample"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<ComponentName Value="VersionForm"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ResourceFilename Value="unit1.lrs"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
18
examples/lclversion/lclversionexample.lpr
Normal file
18
examples/lclversion/lclversionexample.lpr
Normal file
@ -0,0 +1,18 @@
|
||||
program lclversionexample;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms
|
||||
{ you can add units after this }, Unit1;
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TVersionForm, VersionForm);
|
||||
Application.Run;
|
||||
end.
|
||||
|
32
examples/lclversion/unit1.lfm
Normal file
32
examples/lclversion/unit1.lfm
Normal file
@ -0,0 +1,32 @@
|
||||
object VersionForm: TVersionForm
|
||||
Left = 290
|
||||
Height = 300
|
||||
Top = 164
|
||||
Width = 400
|
||||
HorzScrollBar.Page = 399
|
||||
VertScrollBar.Page = 299
|
||||
ActiveControl = Memo1
|
||||
Caption = 'VersionForm'
|
||||
ClientHeight = 300
|
||||
ClientWidth = 400
|
||||
OnCreate = FormCreate
|
||||
object Memo1: TMemo
|
||||
Left = 29
|
||||
Height = 130
|
||||
Top = 19
|
||||
Width = 349
|
||||
Lines.Strings = (
|
||||
'Memo1'
|
||||
)
|
||||
TabOrder = 0
|
||||
end
|
||||
object Button1: TButton
|
||||
Left = 36
|
||||
Height = 25
|
||||
Top = 181
|
||||
Width = 75
|
||||
Caption = 'Button1'
|
||||
OnClick = Button1Click
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
12
examples/lclversion/unit1.lrs
Normal file
12
examples/lclversion/unit1.lrs
Normal file
@ -0,0 +1,12 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TVersionForm','FORMDATA',[
|
||||
'TPF0'#12'TVersionForm'#11'VersionForm'#4'Left'#3'"'#1#6'Height'#3','#1#3'Top'
|
||||
+#3#164#0#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertScrollBar.Pa'
|
||||
+'ge'#3'+'#1#13'ActiveControl'#7#5'Memo1'#7'Caption'#6#11'VersionForm'#12'Cli'
|
||||
+'entHeight'#3','#1#11'ClientWidth'#3#144#1#8'OnCreate'#7#10'FormCreate'#0#5
|
||||
+'TMemo'#5'Memo1'#4'Left'#2#29#6'Height'#3#130#0#3'Top'#2#19#5'Width'#3']'#1
|
||||
+#13'Lines.Strings'#1#6#5'Memo1'#0#8'TabOrder'#2#0#0#0#7'TButton'#7'Button1'#4
|
||||
+'Left'#2'$'#6'Height'#2#25#3'Top'#3#181#0#5'Width'#2'K'#7'Caption'#6#7'Butto'
|
||||
+'n1'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#1#0#0#0
|
||||
]);
|
65
examples/lclversion/unit1.pas
Normal file
65
examples/lclversion/unit1.pas
Normal file
@ -0,0 +1,65 @@
|
||||
unit Unit1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, LCLVersion,
|
||||
StdCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TVersionForm }
|
||||
|
||||
TVersionForm = class(TForm)
|
||||
Button1: TButton;
|
||||
Memo1: TMemo;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
VersionForm: TVersionForm;
|
||||
|
||||
implementation
|
||||
|
||||
{ TVersionForm }
|
||||
|
||||
procedure TVersionForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Memo1.Clear;
|
||||
// check if lcl_version is declared,
|
||||
// then we know if there is support for lcl version information
|
||||
{$if declared(lcl_version)}
|
||||
Memo1.Append('Example which uses the lcl version information');
|
||||
Memo1.Append(format('LCL Version: %s', [lcl_version]));
|
||||
Memo1.Append(format('LCL Major: %d', [lcl_major]));
|
||||
Memo1.Append(format('LCL Minor: %d', [lcl_minor]));
|
||||
Memo1.Append(format('LCL Release: %d', [lcl_release]));
|
||||
{$else}
|
||||
Memo1.Append('No lcl version information available');
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TVersionForm.Button1Click(Sender: TObject);
|
||||
begin
|
||||
Memo1.Clear;
|
||||
{$if (lcl_major=0) and (lcl_minor=9) and (lcl_release<26)}
|
||||
Memo1.Append('This program is compiled with lcl version before 0.9.26');
|
||||
// you cannot use features introduced in 0.9.26
|
||||
{$else}
|
||||
Memo1.Append('This program is compiled with lcl version 0.9.26 or later.');
|
||||
// you can use features available in 0.9.26
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I unit1.lrs}
|
||||
|
||||
end.
|
||||
|
@ -29,6 +29,8 @@ unit AllLCLUnits;
|
||||
interface
|
||||
|
||||
uses
|
||||
// lcl version
|
||||
LCLVersion,
|
||||
// resource strings
|
||||
LCLStrConsts,
|
||||
// base classes
|
||||
|
39
lcl/lclversion.pas
Normal file
39
lcl/lclversion.pas
Normal file
@ -0,0 +1,39 @@
|
||||
{ $Id: controls.pp 12944 2007-11-21 01:05:36Z mattias $ }
|
||||
{
|
||||
/***************************************************************************
|
||||
lclversion.pas
|
||||
-------------------
|
||||
Version numbers for the LCL
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
}
|
||||
unit LCLVersion;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
const
|
||||
lcl_major = 0;
|
||||
lcl_minor = 9;
|
||||
lcl_release = 25;
|
||||
lcl_patch = 0;
|
||||
lcl_version = '0.9.25';
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user