View Issue Details

IDProjectCategoryView StatusLast Update
0019033LazarusLCLpublic2011-04-04 19:21
ReporterAugust KleinAssigned ToMartin Friebe 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.31 (SVN)Product Build 
Target VersionFixed in Version 
Summary0019033: [GTK2] Popup on SynEdit gets wrong PopupComponent
DescriptionTry attached project.

Steps to reproduce:

a) Right-click on Synedit1. A message is show with Popupcomponent Name.
b) Left-click on SynEdit2.
c) Right-click on Synedit2. Popupcomponent Name is wrong and it will not get correct anymore.

Qt and Windows widgetsets are fine.

A proposed fix is uploaded. It ensures that PopupComponent is correctly set.
TagsNo tags attached.
Fixed in Revision30101
LazTarget0.99.0
Widgetset
Attached Files
  • syntest.zip (130,272 bytes)
  • synfix.diff (629 bytes)
    Index: components/synedit/synedit.pp
    ===================================================================
    --- components/synedit/synedit.pp	(revisiĆ³n: 30077)
    +++ components/synedit/synedit.pp	(copia de trabajo)
    @@ -3032,8 +3032,10 @@
       finally
         DecPaintLock;
       end;
    -  if FMouseClickDoPopUp and (PopupMenu <> nil) then
    +  if FMouseClickDoPopUp and (PopupMenu <> nil) then begin
    +    PopupMenu.PopupComponent:=self;
         PopupMenu.PopUp;
    +  end;
       //DebugLn('TCustomSynEdit.MouseUp END Mouse=',X,',',Y,' Caret=',CaretX,',',CaretY,', BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y);
     end;
    
    synfix.diff (629 bytes)

Activities

2011-03-30 14:25

 

syntest.zip (130,272 bytes)

2011-03-30 14:26

 

synfix.diff (629 bytes)
Index: components/synedit/synedit.pp
===================================================================
--- components/synedit/synedit.pp	(revisiĆ³n: 30077)
+++ components/synedit/synedit.pp	(copia de trabajo)
@@ -3032,8 +3032,10 @@
   finally
     DecPaintLock;
   end;
-  if FMouseClickDoPopUp and (PopupMenu <> nil) then
+  if FMouseClickDoPopUp and (PopupMenu <> nil) then begin
+    PopupMenu.PopupComponent:=self;
     PopupMenu.PopUp;
+  end;
   //DebugLn('TCustomSynEdit.MouseUp END Mouse=',X,',',Y,' Caret=',CaretX,',',CaretY,', BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y);
 end;
synfix.diff (629 bytes)

Zeljan Rikalo

2011-03-30 14:40

developer   ~0046943

then how qt and win32 popupcomponent is correct ?

August Klein

2011-03-30 14:56

reporter   ~0046944

I don't know. Maybe MouseUp is not correctly fired on GTK2...I could not find out anymore.

Did you try project attached?

August Klein

2011-03-30 20:56

reporter   ~0046966

A deeper look into this issue has allowed me to realize that Qt and Windows widgetsets are also affected.

Unlike GTK2, both gives me a SIVSEG error if I run the program and directly I do a right-click in SynEdit, but it is caused by same issue (Popupcomponent is not set) so fix is still valid.

Martin Friebe

2011-04-01 00:53

manager   ~0047034

Please test with rev 30101

The patch was correct, but incomplete, there is a 2nd location in SynEdit, where the popup can be shown.

SynEdit did indeed not set the property, this is because SynEdit does not leave it to the LCL code for the popup-event. SynEdit has configuration allowing to trigger the popup at mouse down or up, left or right, with shift/ctrl required or not...; therefore SynEdit handles the popup in the mouse down/up events.

The property may have been set outside SynEdit depending on the OS, as the order of events may be different (I have not checked, if indeed there is a case where it does get set, just could be..)

August Klein

2011-04-04 19:21

reporter   ~0047216

Now it's correct, thanks.

Behaviour differences between GTK2 and others seems to be related to issues 0018956 and 0018966.

Issue History

Date Modified Username Field Change
2011-03-30 14:25 August Klein New Issue
2011-03-30 14:25 August Klein File Added: syntest.zip
2011-03-30 14:25 August Klein Widgetset => GTK 2
2011-03-30 14:26 August Klein File Added: synfix.diff
2011-03-30 14:40 Zeljan Rikalo Note Added: 0046943
2011-03-30 14:56 August Klein Note Added: 0046944
2011-03-30 20:56 August Klein Note Added: 0046966
2011-03-30 23:19 Vincent Snijders LazTarget => 1.0
2011-03-30 23:19 Vincent Snijders Status new => acknowledged
2011-03-30 23:19 Vincent Snijders Target Version => 1.0.0
2011-04-01 00:18 Martin Friebe Status acknowledged => assigned
2011-04-01 00:18 Martin Friebe Assigned To => Martin Friebe
2011-04-01 00:53 Martin Friebe Fixed in Revision => 30101
2011-04-01 00:53 Martin Friebe LazTarget 1.0 => 0.99.0
2011-04-01 00:53 Martin Friebe Widgetset GTK 2 =>
2011-04-01 00:53 Martin Friebe Status assigned => resolved
2011-04-01 00:53 Martin Friebe Fixed in Version => 0.99.0
2011-04-01 00:53 Martin Friebe Resolution open => fixed
2011-04-01 00:53 Martin Friebe Note Added: 0047034
2011-04-01 00:53 Martin Friebe Target Version 1.0.0 => 0.99.0
2011-04-04 19:21 August Klein Status resolved => closed
2011-04-04 19:21 August Klein Note Added: 0047216