Redraw Panel on StatusBar. lazarus / 31-LCL ---------------------------------------------------------------------- Edson · 2013-11-07 21:44 I have written code for the event: StatusBar1DrawPanel() and configured psOwnerDraw style, and it's OK, but my question is: How can I force it execute? I know the StatusBar redraw on Paint event. But I just want to refresh one panel. Is there somethign like: StatusBar1.Panels[0].Refresh? Thanks. ---------------------------------------------------------------------- howardpc · 2013-11-07 22:03 There is StatusBar1.InvalidatePanels() (or just StatusBar1.Invalidate if you're lazy). But why do you need to force it? ---------------------------------------------------------------------- Edson · 2013-11-07 22:10 I have seen StatusBar1.InvalidatePanel(), but I'm not sure if it redraw all the panel. I have seen these options: ppText,   ppBorder,  ppWidth. I want to do some kind of simple animation in one panel. And it's not good to repaint all the StatusBar. ---------------------------------------------------------------------- howardpc · 2013-11-07 22:40 Code: [Select]StatusBar1.InvalidatePanel(0, [ppText]); will just invalidate the text of the first panel, which for a text- based animation is exactly what you want. ---------------------------------------------------------------------- Edson · 2013-11-07 23:25 I'm using the canvas for drawing on the Panel. I'm not using text. I've found that one Panel is redrawn when I change the text property. I'm using this code: Code: [Select]    if StatusBar1.Panels[0].Text = '' then        StatusBar1.Panels[0].Text := 'AnyText'     else        StatusBar1.Panels[0].Text := ''; But It seems too forced. ---------------------------------------------------------------------- engkin · 2013-11-07 23:33 Text or not, PanelParts is not used under Windows, but you have to put any value, otherwise the status bar will not get updated. The chain of events: StatusBar1.InvalidatePanel(PanelIndex, PanelParts)    StatusBar1.UpdateHandleObject(PanelIndex, PanelParts)       :On Windows - TWin32WSStatusBar.PanelUpdate Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i class procedure TWin32WSStatusBar.PanelUpdate(const AStatusBar: TStatusBar; PanelIndex: integer);var  ARect: TRect;begin...  // request invalidate of only panel rectange  SendMessage(AStatusBar.Handle, SB_GETRECT, PanelIndex, LParam(@ARect));  Windows.InvalidateRect(AStatusBar.Handle, ARect, False);end;  To invalidate a small section under Windows, the source code uses: Windows.InvalidateRect(AStatusBar.Handle, ARect, False); ---------------------------------------------------------------------- Edson · 2013-11-08 02:45 I'm trying, using: Code: [Select]    StatusBar1.InvalidatePanel(0, [ppText]); It seems to work too for graphics.