Unit 'msegui' Package
[Overview][Constants][Types][Classes][Procedures and functions][Index] [#msegui]

twidget.canclose

Returns True if the widget and all its children accept to be closed or to lose the focus

Declaration

Source position: msegui.pas line 2270

public function twidget.canclose(

  const newfocus: twidget = Nil

):Boolean; virtual;

Description

Returns True if the widget and all its children accept to be closed or to lose the focus. For a data edit with oe_closequery, a value being edited is checked and stored (as if Enter was pressed), and the result is False if it is invalid. Call it before saving, so that the value being typed is not lost, e.g.:

if container.canclose(nil) then begin
 query.applyupdates;
 transaction.commit;
end;

See also canparentclose, which checks the focused widget first.


Documentation generated on: 2026-10-03