.Lock Method

Top  Previous  Next


Freezes display output (on controllers/panels that support this feature).





See Also:




When the display is locked, you can make changes to the display data without showing these changes on the screen. You can then unlock the display (lcd.unlock) and show all the changes made at once. This usually greatly improves the display agility perception by the user (see Improving Graphical Performance).

Locking the display also prolongs the life of some displays, notably the displays of the OLED type.

When you execute this method for the first time, the display gets locked and the lcd.lockcount R/O property changes from 0 to 1. You can invoke lcd.lock again and again, and the lcd.lockcount will increase with each call to the lcd.lock. This allows you to nest locks/unlocks (again, see Improving Graphical Performance). Of course, the display is not locked "any harder" at lcd.lockcount=2 compared to lcd.lockcount=1. The display is simply locked for all lcd.lockcount values other than 0.

Not all controllers/panels support this feature. See the Supported Controllers/Panels section for details on the display you are using. If your display does not support locking, executing lcd.lock will have no effect and lcd.lockcount will always stay at 0.