procedure A; begin if EditBox1.Text = '' then begin EditBox1.SetFocus; Exit; end; end;
<1Â÷ ¸®ÆÑÅ丵>
function TForm1.chkInputVal(Sender: TObject): Boolean; begin result := false; if TEdit(Sender).Text = EmptyStr then TEdit(Sender).SetFocus else result := true; end;
procedure TForm1.Button1Click(Sender: TObject); begin if Not chkInputVal( Edit1 ) then exit; end;
function TForm1.chkInputVal(Sender: TObject): boolean; label goAbort; begin
result := false;
if (Sender is TEdit) and ((Sender as TEdit).Text = EmptyStr) then goto goAbort; if (Sender is TComboBox) and ((Sender as TComboBox).Text = EmptyStr) then goto goAbort; if (Sender is TMemo) and ((Sender as TMemo).Text = EmptyStr) then goto goAbort; if (Sender is TListBox) and ((Sender as TListBox).Count = 0 ) then goto goAbort;