I saw that you already have a similar question with mine only that is in C # .
I'm doing a field check routine and when one of the date fields is blank it gives the message. I need when one of these fields is in focus, show the field name in the message body.
Code:
if (cbbTipoConsultaEmAberto.ItemIndex = 5) and
((dteDataInicial.Text = ' / / ') or
(dteDataFinal.Text = ' / / ')) then
begin
if (dteDataInicial.Text = ' / / ') then dteDataInicial.SetFocus else
if (dteDataFinal.Text = ' / / ') then dteDataFinal.SetFocus;
Application.MessageBox(PChar('Combinação de Seleção Inválida!'+#13+'Campo:
'+TDBDateEdit({aqui tenho que saber qual o objeto com o foco}).Hint+
' está em branco.'),'Aviso',MB_OK+MB_ICONEXCLAMATION);
exit;
end;