Posts

Showing posts from January, 2013

Static Variable in Delphi...

One time I was discussing with a .Net programmer about static variables. Then I tried to declared a static variable in Delphi but I could not. Because there are no keyword 'Static' in Delphi. So when I checked how to declare a Static variable in Delphi, I found the 'Typed Constant' which acts as static variable in Delphi. By default Delphi doesn't allow static variables, it only allows static methods, functions and properties.  But we can use typed constant to declare a static variable in Delphi. That will work as like static variable in C# that keep their value between routine calls. But this facility was available in Delphi 16 bit version i.e in Delphi 1 which is disappeared in Delphi 32 version. But for backward compatibility still Delphi has an option 'Assignable Typed Constant' option in compiler tab of project option. Project Menu -> Option -> Compiler Tab -> Assignable Typed Constant  You need to check this option for use such faci

Difference between Refresh, repaint, Update and Invalidate in Delphi

Refresh Repaints the control on the screen. Call Refresh method to repaint the control immediately. Refresh calls the Repaint method. Use the Refresh and Repaint methods interchangeably. Repaint  Forces the control to repaint its image on the screen. Call Repaint to force the control to repaint its image immediately. If the ControlStyle property includes csOpaque, the control paints itself directly. Otherwise, the Repaint method calls the Invalidate method and then the Update method so that any visible portions of controls beneath the control will be repainted as well. Update  Processes any pending paint messages immediately. Call Update to force the control to be repainted before any more, possibly time-consuming, processing takes place. Use Update to provide immediate feedback to the user that cannot wait for the Windows paint message to arrive.  Update does not invalidate the control, but simply forces a repaint of any regions that have already been invalidated. Call Repa