Resize Delay With TCairoPaintBox lazarus / 39-Graphics ---------------------------------------------------------------------- Rails · 2011-09-02 19:24 I am starting work on an app that will use Cairo vector graphics from the LuiPack package. When I placed a TCairoPaintBox on my main form, I started experiencing delays when resizing the form by dragging outward. The PaintBox and other controls respond sluggishly. The delay is quite noticeable. Resizing by dragging inward responds normally. The TCairoPaintBox's align property is set to alClient. If I set it to alNone, the delay is reduced significantly, but is still perceptible. No other control is set to alClient.  As of yet, I have not written any code to draw on the PaintBox, so that isn't causing it. I removed the TCairoPaintBox and substituted a TPaintBox in its place. Everything worked normally. I have attached photos of the app before resizing and during resizing. The delay is obvious. Does anyone know why this could be happening? Thank you. Edit: This is on a Linux system, not Windows. My apologies for not mentioning that originally. ---------------------------------------------------------------------- User137 · 2011-09-02 22:23 It simply sounds like bug in TCairoPaintBox. It's doing too much updates, maybe drawing things while resizing. Possibly it's only reserving new memory space when increasing the area, but keeping current space when going smaller. ---------------------------------------------------------------------- Rails · 2011-09-03 13:25 Well, it's not drawing anything. It does it with a blank canvas. I've looked through the TCairoPaintBox source and couldn't find anything obviously wrong, but it's a fair bit above my level, so I could easily have overlooked something. I could post it, if anyone is interested. ---------------------------------------------------------------------- User137 · 2011-09-04 07:31 Well, you could manually add a delay to the TCairoPaintBox resizing, with for example TTimer. Have variable SizeModified: boolean; and in onFormResize make SizeModified:=true; TCairoPaintBox must have align set to alNone, and no anchor resizing. Then in TTimer (interval maybe 100 or 500, experiment..): Code: [Select]if SizeModified then begin   SizeModified:=false;   // Simulate alClient align mode   CairoPaintBox.Width:=Width;   CairoPaintBox.Height:=Height; end;In formCreate you have initialized with: Code: [Select]CairoPaintBox.Left:=0; CairoPaintBox.Top:=0; CairoPaintBox.Width:=Width; CairoPaintBox.Height:=Height; All this does is reduce cpu load, and let your form be resized more smoothly. The paintbox just will not update in realtime but in small delay. ---------------------------------------------------------------------- Rails · 2011-09-11 22:24 Thanks for the suggestion, 137. I think I'm going to live with the delay for now, and see if it gets any worse when I paint a lot more of the canvas.  I will keep your suggestion in mind. I also edited the title to clarify the subject of the thread a bit. ---------------------------------------------------------------------- benohb · 2011-10-04 02:44 CairoPaintBox->align-=alclient CairoPaintBox->BorderSpacing->left =  (Width control ..On the right); controlright->anchors-> akbotton =false                                   ->left false                                   -> right true (TFormMain)                                   -> top false The same thing at the bottom and the top and on the left 'Use CairoPaintBox->BorderSpacing