View Issue Details

IDProjectCategoryView StatusLast Update
0020394LazarusLCLpublic2011-10-23 03:15
ReporterFelipe Monteiro de Carvalho Assigned ToLuiz Americo  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Summary0020394: Regression: TDBEdit looses information
DescriptionAttached a test project. Steps to reproduce:

1> Start the application
2> Click on the TDBEdit, copy part of the text from this edit to itself (for example somewhere in the beginning of it)
3> Now write something

Result:

It looses what was previously there from the copy

I can reproduce in Mac and in Linux. (didn't test Windows)

I found that this revision introduces the issue:

http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/lcl/dbctrls.pp?root=lazarus&r1=32256&r2=32255&pathrev=32256
TagsNo tags attached.
Fixed in Revision33035
LazTarget0.99.0
Widgetset
Attached Files

Relationships

related to 0020475 resolvedZeljan Rikalo LM_CLEAR, LM_CUT, LM_PASTE and LM_COPY are not sent by Qt 
related to 0020330 assignedLuiz Americo Text of TEdit is changed before LM_PASTE message is handled 
related to 0020528 closedBart Broersma Passing value to DBEdit doesnt work as expected in Carbon 

Activities

2011-10-02 20:58

 

sdf.zip (345,249 bytes)

Felipe Monteiro de Carvalho

2011-10-17 08:51

developer   ~0053077

I verified that the edit control is created correct and we get a positive result from the installation of the event handler (from carbonprivatecontrol.inc line 225):

procedure TCarbonControl.RegisterEvents;
var
  TmpSpec: EventTypeSpec;
  Events: TCarbonControlEvents;
begin
  ....
  TmpSpec := MakeEventSpec(kEventClassCommand, kEventCommandProcess);
  InstallControlEventHandler(Widget,
    RegisterEventHandler(@CarbonControl_CommandProcess),
    1, @TmpSpec, Pointer(Self), nil); <-- Here it returns True


So I think we are totally cornered. As far as I can tell this is a bug in Mac OS X, and I don't see how to obtain that event. Everything is done correct. It just doesn't send us the event...

Felipe Monteiro de Carvalho

2011-10-17 10:16

developer   ~0053082

Maybe always start the database in editing mode in LCLCarbon?

Luiz Americo

2011-10-20 13:41

developer   ~0053200

> Maybe always start the database in editing mode in LCLCarbon?

There's two options:

1) Put in edit state as soon as enter control in LCLCarbon. It seems safe but can have side effects.

2) Revert to the old behavior. It's was a subtle bug, less annoying but still a bug that can lead to data loss.

Felipe Monteiro de Carvalho

2011-10-20 16:37

developer   ~0053209

I like solution 1.

What was the old bug from solution 2?

Luiz Americo

2011-10-21 00:43

developer   ~0053220

> What was the old bug from solution 2

Paste some text.
Exit from control without editing
Pasted text is lost

Felipe Monteiro de Carvalho

2011-10-21 14:03

developer   ~0053235

Ok, so could you implement solution 1? I think that this might be a problem to implement because the LCL does not receive the LCLCarbon define. But maybe it should, I also want this for LCLAndroid.

Vincent Snijders

2011-10-21 14:15

manager   ~0053236

If the LCL would need the LCLCarbon define, it means that the LCL needs to be recompiled for each different widget set.

Better query the widget for some capability and keep the LCL widget set independent.

Felipe Monteiro de Carvalho

2011-10-21 14:42

developer   ~0053239

Indeed, you are right ... the build system would need to be changed, so we need to use a mechanism to query capabilities. I think that there is already that somewhere.

This one could be: AreLMPASTECOPYReliable =D LCLCarbon responds: NO

Vincent Snijders

2011-10-21 15:12

manager   ~0053241

What I meant is (without change in the build system, but using existing architecture):

extend:
http://lazarus-ccr.sourceforge.net/docs/lcl/interfacebase/tlclcapability.html

Add for example: lcCanPasteCopyReliable

then extend:
http://lazarus-ccr.sourceforge.net/docs/lcl/interfacebase/twidgetset.getlclcapability.html
so that it return http://lazarus-ccr.sourceforge.net/docs/lcl/interfacebase/lcl_capability_yes.html by default
and TCarbonWidgetset can return lcl_capability_no.

Felipe Monteiro de Carvalho

2011-10-21 15:49

developer   ~0053242

It is not really about copying and pasting, but rather receiving those messages or not, so I would name it:

lcReceivesLMClearCutCopyPasteReliably

Felipe Monteiro de Carvalho

2011-10-22 20:36

developer   ~0053296

Ok, I implemented the capability with the name lcReceivesLMClearCutCopyPasteReliably.

Luiz Americo can you fix the rest? thanks

Luiz Americo

2011-10-23 03:14

developer   ~0053314

Please test.
At first look should not have problems but is unpredictable.

Issue History

Date Modified Username Field Change
2011-10-02 20:58 Felipe Monteiro de Carvalho New Issue
2011-10-02 20:58 Felipe Monteiro de Carvalho File Added: sdf.zip
2011-10-02 20:58 Felipe Monteiro de Carvalho LazTarget => -
2011-10-02 20:58 Felipe Monteiro de Carvalho Status new => assigned
2011-10-02 20:58 Felipe Monteiro de Carvalho Assigned To => Luiz Americo
2011-10-02 21:38 Felipe Monteiro de Carvalho LazTarget - => 0.99.0
2011-10-02 21:38 Felipe Monteiro de Carvalho Description Updated
2011-10-13 14:39 Felipe Monteiro de Carvalho Relationship added related to 0020475
2011-10-13 14:39 Felipe Monteiro de Carvalho Relationship added related to 0020330
2011-10-17 08:51 Felipe Monteiro de Carvalho Note Added: 0053077
2011-10-17 10:16 Felipe Monteiro de Carvalho Note Added: 0053082
2011-10-20 12:54 Felipe Monteiro de Carvalho Relationship added related to 0020528
2011-10-20 13:41 Luiz Americo Note Added: 0053200
2011-10-20 16:37 Felipe Monteiro de Carvalho Note Added: 0053209
2011-10-21 00:43 Luiz Americo Note Added: 0053220
2011-10-21 14:03 Felipe Monteiro de Carvalho Note Added: 0053235
2011-10-21 14:15 Vincent Snijders Note Added: 0053236
2011-10-21 14:42 Felipe Monteiro de Carvalho Note Added: 0053239
2011-10-21 15:12 Vincent Snijders Note Added: 0053241
2011-10-21 15:49 Felipe Monteiro de Carvalho Note Added: 0053242
2011-10-22 20:36 Felipe Monteiro de Carvalho Fixed in Revision => 33028
2011-10-22 20:36 Felipe Monteiro de Carvalho Note Added: 0053296
2011-10-23 03:14 Luiz Americo Fixed in Revision 33028 => 33035
2011-10-23 03:14 Luiz Americo Status assigned => resolved
2011-10-23 03:14 Luiz Americo Resolution open => fixed
2011-10-23 03:14 Luiz Americo Note Added: 0053314