richmemo: update link sample to be pure GUI application, properly name button captions

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4078 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2015-04-06 03:11:57 +00:00
parent 0fe137b895
commit bb76adab15
3 changed files with 19 additions and 8 deletions

View File

@ -46,6 +46,7 @@
<Filename Value="unit1.pas"/> <Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/> <ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/> <UnitName Value="Unit1"/>
</Unit1> </Unit1>
@ -61,6 +62,13 @@
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other> <Other>
<CompilerMessages> <CompilerMessages>
<MsgFileName Value=""/> <MsgFileName Value=""/>

View File

@ -16,7 +16,9 @@ object Form1: TForm1
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
HideSelection = False HideSelection = False
Lines.Strings = ( Lines.Strings = (
'RichMemo1' 'RichMemo1 RichMemo1 '
'RichMemo1 RichMemo1 '
'RichMemo1 RichMemo1 '
) )
OnMouseUp = RichMemo1MouseUp OnMouseUp = RichMemo1MouseUp
TabOrder = 0 TabOrder = 0
@ -26,17 +28,17 @@ object Form1: TForm1
Left = 8 Left = 8
Height = 25 Height = 25
Top = 8 Top = 8
Width = 75 Width = 96
Caption = 'Button1' Caption = 'Make Link'
OnClick = Button1Click OnClick = Button1Click
TabOrder = 1 TabOrder = 1
end end
object Button2: TButton object Button2: TButton
Left = 88 Left = 120
Height = 25 Height = 25
Top = 8 Top = 8
Width = 75 Width = 96
Caption = 'Button2' Caption = 'Unlink'
OnClick = Button2Click OnClick = Button2Click
TabOrder = 2 TabOrder = 2
end end

View File

@ -61,8 +61,9 @@ end;
procedure TForm1.OnLinkAction(Sender: TObject; AAction: TLinkAction; procedure TForm1.OnLinkAction(Sender: TObject; AAction: TLinkAction;
const AMouseInfo: TLinkMouseInfo; StartChar, LenChars: Integer); const AMouseInfo: TLinkMouseInfo; StartChar, LenChars: Integer);
begin begin
if AMouseInfo.button = mbLeft then if AMouseInfo.button = mbLeft then begin
writeln('sel: ', StartChar,' ', LenChars); ShowMessage( 'Link Text: "'+RichMemo1.GetText(StartChar, LenChars)+'"' );
end;
end; end;
end. end.