View Issue Details

IDProjectCategoryView StatusLast Update
0023057LazarusLCLpublic2012-10-10 14:01
ReporterAndrey Zubarev Assigned ToZeljan Rikalo  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.0.1 (SVN) 
Summary0023057: ComboBox with style csOwnerDrawFixed and Canvas.Line
Descriptionprocedure TForm1._ondrwitem(Control: TWinControl; Index: Integer; ARect: TRect;
  State: TOwnerDrawState);
var
   y:integer;
begin
     y:=(ARect.Top+ARect.Bottom)div 2;
     TComboBox(Control).canvas.Line(ARect.Left,y+index*2,ARect.Left+50,y+index*2);
     TComboBox(Control).canvas.Rectangle(ARect.Left,y,ARect.Left+10,y+10);
end;

This OnDrawItem procefure not working properly. –°oordinates for canvas.Line wrong, while for canvas.Rectangle correct
TagsNo tags attached.
Fixed in Revision39034,39036,39037
LazTarget-
WidgetsetGTK 2
Attached Files

Activities

2012-10-04 18:47

 

wrongcombo.png (354,407 bytes)

Andrey Zubarev

2012-10-04 19:05

reporter   ~0062884

>>y+index*2
to be seen that all lines are drawn on the site of first item

Andrey Zubarev

2012-10-06 20:14

reporter   ~0062960

patch, perhaps wrongly:

Index: gtk2winapi.inc
===================================================================
--- . (revision 38897)
+++ . (working copy)
@@ -6464,14 +6464,14 @@
 
   FromPt := DevCtx.PenPos;
   LPtoDP(DC, FromPt, 1);
- ToPt := Point(X, Y);
+ ToPt := Point(X+DevCtx.Offset.X, Y+DevCtx.Offset.Y);
   LPToDP(DC, ToPt, 1);
   
   {$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
   gdk_draw_line(DevCtx.Drawable, DevCtx.GC, FromPt.X, FromPt.Y, ToPt.X, ToPt.Y);
   {$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
 
- DevCtx.PenPos := Point(X, Y);
+ DevCtx.PenPos :=Point(X+DevCtx.Offset.X, Y+DevCtx.Offset.Y);
 
   Result := True;
 end;
@@ -6629,6 +6629,8 @@
 
  ------------------------------------------------------------------------------}
 function TGtk2WidgetSet.MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean;
+var
+ DevCtx: TGtkDeviceContext absolute DC;
 begin
   Result := IsValidDC(DC);
   if Result then
@@ -6637,7 +6639,7 @@
       if Assigned(OldPoint) then
         OldPoint^ := PenPos;
 
- PenPos := Point(X, Y);
+ PenPos := Point(X+DevCtx.Offset.X, Y+DevCtx.Offset.Y);
     end;
 end;

Zeljan Rikalo

2012-10-07 09:42

developer   ~0062965

Please attach example.

2012-10-07 10:10

 

wrongcombo.zip (129,456 bytes)

Andrey Zubarev

2012-10-07 10:10

reporter   ~0062966

ok. see wrongcombo.zip

2012-10-07 10:23

 

goodcombo.png (4,037 bytes)   
goodcombo.png (4,037 bytes)   

Zeljan Rikalo

2012-10-10 09:03

developer   ~0063046

Please test and close if ok.

Paul Ishenin

2012-10-10 12:58

manager   ~0063050

The patch is wrong. PenPos should not store the Offset difference because in MoveToEx() it returns the old point which will not be the same point which you set by previous MoveToEx().

Zeljan Rikalo

2012-10-10 13:55

developer   ~0063052

Fixed

Andrey Zubarev

2012-10-10 14:01

reporter   ~0063054

thanks

Issue History

Date Modified Username Field Change
2012-10-04 18:47 Andrey Zubarev New Issue
2012-10-04 18:47 Andrey Zubarev File Added: wrongcombo.png
2012-10-04 18:47 Andrey Zubarev Widgetset => GTK 2
2012-10-04 19:05 Andrey Zubarev Note Added: 0062884
2012-10-06 20:14 Andrey Zubarev Note Added: 0062960
2012-10-07 09:42 Zeljan Rikalo LazTarget => -
2012-10-07 09:42 Zeljan Rikalo Note Added: 0062965
2012-10-07 09:42 Zeljan Rikalo Status new => feedback
2012-10-07 10:10 Andrey Zubarev File Added: wrongcombo.zip
2012-10-07 10:10 Andrey Zubarev Note Added: 0062966
2012-10-07 10:23 Andrey Zubarev File Added: goodcombo.png
2012-10-09 07:37 Zeljan Rikalo Assigned To => Zeljan Rikalo
2012-10-09 07:37 Zeljan Rikalo Status feedback => assigned
2012-10-10 09:03 Zeljan Rikalo Fixed in Revision => 39034
2012-10-10 09:03 Zeljan Rikalo Status assigned => resolved
2012-10-10 09:03 Zeljan Rikalo Resolution open => fixed
2012-10-10 09:03 Zeljan Rikalo Note Added: 0063046
2012-10-10 12:58 Paul Ishenin Status resolved => assigned
2012-10-10 12:58 Paul Ishenin Resolution fixed => reopened
2012-10-10 12:58 Paul Ishenin Note Added: 0063050
2012-10-10 13:55 Zeljan Rikalo Fixed in Revision 39034 => 39034,39036,39037
2012-10-10 13:55 Zeljan Rikalo Status assigned => resolved
2012-10-10 13:55 Zeljan Rikalo Resolution reopened => fixed
2012-10-10 13:55 Zeljan Rikalo Note Added: 0063052
2012-10-10 14:01 Andrey Zubarev Status resolved => closed
2012-10-10 14:01 Andrey Zubarev Note Added: 0063054