[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Forces fpGUI to act on window position and size properties
Source position: fpg_base.pas line 514
public procedure TfpgWindowBase.UpdateWindowPosition; |
fpGUI implements what is called "delayed resource allocation". It delays some action until everything is ready to go. This delayed action applies to setting Widget or Form size and position. Why? Imagine you have a complex form with lots of anchors, alignments and OnResize event handlers. Now somewhere in there you change the size or position of a component.
MyWidget.Left := ... MyWidget.Top := ... MyWidget.Width := ... MyWidget.Height := ...
If fpGUI acted immediately, as every property is set, it means it would have to recalculate all those widget boundaries, and fire all OnResize event handlers of the whole form four times. Once for each property - as you set them. Not very efficient! To reduce such redundant calculations, fpGUI allows you to set all the properties, then act on it once you call UpdateWindowPosition. In most cases fpGUI can even reduce the API calls needed, because it could pass for example Width and Height via one API call. In the case of X11, it can actually do all four values in a single API call. Thus improving efficiency and reduces resize calculations and screen redraws.