1 (edited by aavila 2019-03-15 21:41:05)

Topic: TextBox Filled If is nil

Hi, i have several textbox in a form, i want to make an event "onExit" when the user leave the textbox with nil (nothing) value, the textbox autofill with "0"

but i want make only 1 function to replicate on all my textbox, how i can autocall the sender(textbox itself)??

Here an example of the code i try to use:

procedure frmQuoting_lic1_OnExit (Sender: TObject);
begin
    if Sender.Text = nil then
    begin
       Sender.Text := IntToStr(0);
    end;
end;

Thanks in Advanced!

Re: TextBox Filled If is nil

I solve! Here i Post the Result for help any other

procedure frmQuoting_lic1_OnExit (Sender: TObject);

begin
    if TEdit(Sender).Text = '' then
    begin
       TEdit(Sender).Text := '0';
    end;

end;