View Issue Details

IDProjectCategoryView StatusLast Update
0035037LazarusLCLpublic2020-06-05 05:17
ReporterMarkus Müller Assigned ToJesus Reyes  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
PlatformAny 
Product Version2.1 (SVN) 
Summary0035037: TDBMemo, cannot make a custom change from the displayed text
DescriptionIf the TField.OnGetText is used with convert the String into a TDBGrid, the TDBMemo use the same conversion.
But I need a other text in the TDBMemo, a non converted.

For this I thing the most flexibility is having extra events in TDBMemo.OnGetText / OnSetText.
Steps To ReproduceThe new function should work like this:

IF Assigned(TDBMemo.OnGetText) Then
  Use TDBMemo.OnGetText
ELSE IF Assigned(DalaLink.Field.OnGetText) Then
  Use DalaLink.Field.OnGetText
ELSE
  USE DalaLink.Field.AsString
Additional InformationI have make the changes ready from the TDBMemo Sources, please load it into the Lazarus sources.

If the new events TDBMemo.OnGetText/OnSetText are not used, the TDBMemo works the same as before.

Thx for help to solve my big problem where is coming in with Lazarus V2
TagsTDBMemo
Fixed in Revision
LazTarget
Widgetset
Attached Files

Relationships

related to 0035026 closedwp TDBMemo does use the OnGetText property from TField and cannot deactivated 

Activities

Markus Müller

2019-02-07 21:41

reporter  

TDBMemo_Fix.zip (12,448 bytes)

Markus Müller

2019-02-07 22:35

reporter   ~0113933

More informations about this in the german lazarus forum:
http://www.lazarusforum.de/viewtopic.php?p=108031#p108031

Markus Müller

2019-02-07 22:57

reporter  

TDBMemo_Fix2.zip (12,475 bytes)

Markus Müller

2019-02-07 22:58

reporter   ~0113934

Last edited: 2019-02-07 22:59

View 2 revisions

I have make a new event type for the new TDBMemo, the "Sender" must be self:

TDBCtrlsGetTextEvent = procedure(Sender: TObject; Field: TField; var aText: string) of object;
TDBCtrlsSetTextEvent = procedure(Sender: TObject; Field: TField; const aText: string) of object;

Fixed in the file "TDBMemo_Fix2.zip"

Markus Müller

2019-02-07 23:09

reporter  

Bild1.png (8,053 bytes)   
Bild1.png (8,053 bytes)   

Markus Müller

2019-02-07 23:09

reporter  

Bild2.png (8,366 bytes)   
Bild2.png (8,366 bytes)   

Markus Müller

2019-02-07 23:09

reporter  

Bild3.png (8,942 bytes)   
Bild3.png (8,942 bytes)   

Markus Müller

2019-02-07 23:11

reporter   ~0113936

The source code from the pictures:

procedure TForm1.ZQuery1ValMemoGetText(Sender: TField; var aText: string;
  DisplayText: Boolean);
var s: string;
begin
  s := StringReplace(Sender.AsString, LineEnding, '¶', [rfReplaceAll]);
  s := StringReplace(s, 0000013, '¶', [rfReplaceAll]);
  s := StringReplace(s, 0000010, '', [rfReplaceAll]);
  if Length(s) > 250 then
    aText := UTF8Copy(s, 1, 250) + '...'
  else aText := s;
end;
 
procedure TForm1.DBMemo1GetText(Sender: TObject; Field: TField; var aText: string);
begin
  aText := Field.AsString;
end;

Juha Manninen

2020-05-22 19:43

developer   ~0123005

A patch please.
 https://wiki.freepascal.org/Creating_A_Patch

Issue History

Date Modified Username Field Change
2019-02-07 21:41 Markus Müller New Issue
2019-02-07 21:41 Markus Müller File Added: TDBMemo_Fix.zip
2019-02-07 21:44 Markus Müller Tag Attached: TDBMemo
2019-02-07 22:22 Michl Relationship added related to 0035026
2019-02-07 22:35 Markus Müller Note Added: 0113933
2019-02-07 22:57 Markus Müller File Added: TDBMemo_Fix2.zip
2019-02-07 22:58 Markus Müller Note Added: 0113934
2019-02-07 22:59 Markus Müller Note Edited: 0113934 View Revisions
2019-02-07 23:09 Markus Müller File Added: Bild1.png
2019-02-07 23:09 Markus Müller File Added: Bild2.png
2019-02-07 23:09 Markus Müller File Added: Bild3.png
2019-02-07 23:11 Markus Müller Note Added: 0113936
2020-05-22 19:43 Juha Manninen Note Added: 0123005
2020-06-05 05:17 Jesus Reyes Assigned To => Jesus Reyes
2020-06-05 05:17 Jesus Reyes Status new => assigned