From 6a5ffd25335256cc002ac99d329ef9e904080de2 Mon Sep 17 00:00:00 2001 From: skalogryz Date: Sat, 19 Sep 2009 18:11:58 +0000 Subject: [PATCH] richmemo: fix for win32 OnChange event after GetAttributes proc. Removed debug out from sample project git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@961 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../richmemo/samples/testsimple/project1.lpi | 172 ++++++------------ .../richmemo/samples/testsimple/unit1.lfm | 3 +- .../richmemo/samples/testsimple/unit1.lrs | 52 +++--- .../richmemo/samples/testsimple/unit1.pas | 7 + components/richmemo/win32/win32richmemo.pas | 6 +- 5 files changed, 89 insertions(+), 151 deletions(-) diff --git a/components/richmemo/samples/testsimple/project1.lpi b/components/richmemo/samples/testsimple/project1.lpi index 16ba51c37..056218530 100644 --- a/components/richmemo/samples/testsimple/project1.lpi +++ b/components/richmemo/samples/testsimple/project1.lpi @@ -6,7 +6,7 @@ - + @@ -47,8 +47,8 @@ - - + + @@ -236,11 +236,9 @@ - - - + + - @@ -312,8 +310,8 @@ - - + + @@ -321,14 +319,12 @@ - - - + + - @@ -365,13 +361,11 @@ - + - - @@ -381,180 +375,118 @@ - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - - - - - - - - - + + + + + + + + + + + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/richmemo/samples/testsimple/unit1.lfm b/components/richmemo/samples/testsimple/unit1.lfm index 4954267d4..ad12850f0 100644 --- a/components/richmemo/samples/testsimple/unit1.lfm +++ b/components/richmemo/samples/testsimple/unit1.lfm @@ -8,7 +8,7 @@ object Form1: TForm1 ClientHeight = 457 ClientWidth = 634 OnCreate = FormCreate - LCLVersion = '0.9.27' + LCLVersion = '0.9.29' object RichMemo1: TRichMemo Left = 15 Height = 358 @@ -21,6 +21,7 @@ object Form1: TForm1 Lines.Strings = ( 'RichMemo1' ) + OnChange = RichMemo1Change ParentFont = False ScrollBars = ssVertical TabOrder = 0 diff --git a/components/richmemo/samples/testsimple/unit1.lrs b/components/richmemo/samples/testsimple/unit1.lrs index eb58f889a..ab4e2197e 100644 --- a/components/richmemo/samples/testsimple/unit1.lrs +++ b/components/richmemo/samples/testsimple/unit1.lrs @@ -4,32 +4,32 @@ LazarusResources.Add('TForm1','FORMDATA',[ 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#196#0#6'Height'#3#201#1#3'Top'#3#181#0#5 +'Width'#3'z'#2#13'ActiveControl'#7#9'RichMemo1'#7'Caption'#6#5'Form1'#12'Cli' +'entHeight'#3#201#1#11'ClientWidth'#3'z'#2#8'OnCreate'#7#10'FormCreate'#10'L' - +'CLVersion'#6#6'0.9.27'#0#9'TRichMemo'#9'RichMemo1'#4'Left'#2#15#6'Height'#3 + +'CLVersion'#6#6'0.9.29'#0#9'TRichMemo'#9'RichMemo1'#4'Left'#2#15#6'Height'#3 +'f'#1#3'Top'#2#16#5'Width'#3'k'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight' +#8'akBottom'#0#11'Font.Height'#2#243#9'Font.Name'#6#6'Tahoma'#13'HideSelecti' - +'on'#8#13'Lines.Strings'#1#6#9'RichMemo1'#0#10'ParentFont'#8#10'ScrollBars'#7 - +#10'ssVertical'#8'TabOrder'#2#0#0#0#7'TButton'#7'Button1'#4'Left'#2#24#6'Hei' - +'ght'#2#25#3'Top'#3'~'#1#5'Width'#3#160#0#7'Anchors'#11#6'akLeft'#8'akBottom' - +#0#7'Caption'#6#17'Make Bold and Red'#7'OnClick'#7#12'Button1Click'#8'TabOrd' - +'er'#2#1#7'TabStop'#8#0#0#7'TButton'#7'Button2'#4'Left'#3#192#0#6'Height'#2 - +#25#3'Top'#3'~'#1#5'Width'#2'a'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Capt' - +'ion'#6#11'Get Attribs'#7'OnClick'#7#12'Button2Click'#8'TabOrder'#2#2#7'TabS' - +'top'#8#0#0#7'TButton'#7'Button3'#4'Left'#3'0'#1#6'Height'#2#25#3'Top'#3'~'#1 - +#5'Width'#2'`'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#11'Select ' - +'Font'#7'OnClick'#7#12'Button3Click'#8'TabOrder'#2#3#7'TabStop'#8#0#0#7'TBut' - +'ton'#7'Button4'#4'Left'#3#16#2#6'Height'#2#25#3'Top'#3'~'#1#5'Width'#2'K'#7 - +'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#8'Save RTF'#7'OnClick'#7#12 - +'Button4Click'#8'TabOrder'#2#4#7'TabStop'#8#0#0#7'TButton'#7'Button5'#4'Left' - +#3#184#1#6'Height'#2#25#3'Top'#3'~'#1#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8 - +'akBottom'#0#7'Caption'#6#8'Load RTF'#7'OnClick'#7#12'Button5Click'#8'TabOrd' - +'er'#2#5#7'TabStop'#8#0#0#7'TButton'#7'Button6'#4'Left'#2#24#6'Height'#2#25#3 - +'Top'#3#159#1#5'Width'#3#160#0#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Capti' - +'on'#6#16'Next Style Range'#7'OnClick'#7#12'Button6Click'#8'TabOrder'#2#6#7 - +'TabStop'#8#0#0#11'TFontDialog'#11'FontDialog1'#11'MinFontSize'#2#0#11'MaxFo' - +'ntSize'#2#0#4'left'#3'`'#1#3'top'#3#173#1#0#0#11'TSaveDialog'#11'SaveDialog' - +'1'#10'DefaultExt'#6#4'.rtf'#6'Filter'#6#27'RichText file (*.rtf)|*.rtf'#7'O' - +'ptions'#11#17'ofOverwritePrompt'#14'ofEnableSizing'#12'ofViewDetail'#0#4'le' - +'ft'#3#24#1#3'top'#3#173#1#0#0#11'TOpenDialog'#11'OpenDialog1'#10'DefaultExt' - +#6#4'.rtf'#6'Filter'#6#27'RichText file (*.rtf)|*.rtf'#4'left'#3#208#0#3'top' - +#3#173#1#0#0#0 + +'on'#8#13'Lines.Strings'#1#6#9'RichMemo1'#0#8'OnChange'#7#15'RichMemo1Change' + +#10'ParentFont'#8#10'ScrollBars'#7#10'ssVertical'#8'TabOrder'#2#0#0#0#7'TBut' + +'ton'#7'Button1'#4'Left'#2#24#6'Height'#2#25#3'Top'#3'~'#1#5'Width'#3#160#0#7 + +'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#17'Make Bold and Red'#7'On' + +'Click'#7#12'Button1Click'#8'TabOrder'#2#1#7'TabStop'#8#0#0#7'TButton'#7'But' + +'ton2'#4'Left'#3#192#0#6'Height'#2#25#3'Top'#3'~'#1#5'Width'#2'a'#7'Anchors' + +#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#11'Get Attribs'#7'OnClick'#7#12'But' + +'ton2Click'#8'TabOrder'#2#2#7'TabStop'#8#0#0#7'TButton'#7'Button3'#4'Left'#3 + +'0'#1#6'Height'#2#25#3'Top'#3'~'#1#5'Width'#2'`'#7'Anchors'#11#6'akLeft'#8'a' + +'kBottom'#0#7'Caption'#6#11'Select Font'#7'OnClick'#7#12'Button3Click'#8'Tab' + +'Order'#2#3#7'TabStop'#8#0#0#7'TButton'#7'Button4'#4'Left'#3#16#2#6'Height'#2 + +#25#3'Top'#3'~'#1#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Capt' + +'ion'#6#8'Save RTF'#7'OnClick'#7#12'Button4Click'#8'TabOrder'#2#4#7'TabStop' + +#8#0#0#7'TButton'#7'Button5'#4'Left'#3#184#1#6'Height'#2#25#3'Top'#3'~'#1#5 + +'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#8'Load RTF'#7 + +'OnClick'#7#12'Button5Click'#8'TabOrder'#2#5#7'TabStop'#8#0#0#7'TButton'#7'B' + +'utton6'#4'Left'#2#24#6'Height'#2#25#3'Top'#3#159#1#5'Width'#3#160#0#7'Ancho' + +'rs'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#16'Next Style Range'#7'OnClick' + +#7#12'Button6Click'#8'TabOrder'#2#6#7'TabStop'#8#0#0#11'TFontDialog'#11'Font' + +'Dialog1'#11'MinFontSize'#2#0#11'MaxFontSize'#2#0#4'left'#3'`'#1#3'top'#3#173 + +#1#0#0#11'TSaveDialog'#11'SaveDialog1'#10'DefaultExt'#6#4'.rtf'#6'Filter'#6 + +#27'RichText file (*.rtf)|*.rtf'#7'Options'#11#17'ofOverwritePrompt'#14'ofEn' + +'ableSizing'#12'ofViewDetail'#0#4'left'#3#24#1#3'top'#3#173#1#0#0#11'TOpenDi' + +'alog'#11'OpenDialog1'#10'DefaultExt'#6#4'.rtf'#6'Filter'#6#27'RichText file' + +' (*.rtf)|*.rtf'#4'left'#3#208#0#3'top'#3#173#1#0#0#0 ]); diff --git a/components/richmemo/samples/testsimple/unit1.pas b/components/richmemo/samples/testsimple/unit1.pas index 453399519..a2331f51f 100644 --- a/components/richmemo/samples/testsimple/unit1.pas +++ b/components/richmemo/samples/testsimple/unit1.pas @@ -31,6 +31,7 @@ type procedure Button5Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure FormCreate(Sender: TObject); + procedure RichMemo1Change(Sender: TObject); private { private declarations } public @@ -124,6 +125,12 @@ procedure TForm1.FormCreate(Sender: TObject); begin end; +procedure TForm1.RichMemo1Change(Sender: TObject); +begin + Caption := Caption + '.'; + if length(CAption)>20 then Caption:=''; +end; + initialization {$I unit1.lrs} diff --git a/components/richmemo/win32/win32richmemo.pas b/components/richmemo/win32/win32richmemo.pas index 9361e9dc9..1371daa6b 100644 --- a/components/richmemo/win32/win32richmemo.pas +++ b/components/richmemo/win32/win32richmemo.pas @@ -204,7 +204,6 @@ var NeedLock : Boolean; eventmask : LongWord; begin - writeln('[GetTextAttributes] begin'); if not Assigned(RichEditManager) or not Assigned(AWinControl) then begin Result := false; Exit; @@ -221,15 +220,14 @@ begin RichEditManager.SetSelection(AWinControl.Handle, TextStart, 1); Result := RichEditManager.GetSelectedTextStyle(AWinControl.Handle, Params ); RichEditManager.SetSelection(AWinControl.Handle, OrigStart, OrigLen); - UnlockRedraw(AWinControl.Handle); + UnlockRedraw(AWinControl.Handle, false); end else begin LockRedraw(AWinControl.Handle); Result := RichEditManager.GetSelectedTextStyle(AWinControl.Handle, Params); - UnlockRedraw(AWinControl.Handle); + UnlockRedraw(AWinControl.Handle, false); end; SendMessage(AWinControl.Handle, EM_SETEVENTMASK, 0, eventmask); - writeln('[GetTextAttributes] end'); end;