Hi (Salam Alaykom),
I have a button "clear" , I want when the button is clicked the items will be cleared and the cursor is at the first item, here is the code:
:emp.id:=null;
:emp.ename:=null;
:emp.sal:=null;
go_item('emp.id');

*=>but the problem that the item changes color, but the cursor remains at the button "clear"*

NOTE:
I used the "when-new-item-instance" trigger to change the color of text items

I have a button "clear" , I want when the button is clicked the items will be cleared and the cursor is at the first item, here is the code:
:emp.id:=null;
:emp.ename:=null;
:emp.sal:=null;
go_item('emp.id');

Not need of this, simply issue of

go_block('emp');
clear_block;

*=>but the problem that the item changes color, but the cursor remains at the button "clear"*

does your button in the same block ? means button also in the emp block or any other block ? EMP block is tabular ??
Do you have when-new-record-instance trigger at emp block ? if yes what is the code ?

NOTE:
I used the "when-new-item-instance" trigger to change the color of text items

I knew why the cursor has become at the first item text because when I click on email button "clear" message is displayed (my own message I put the code in the last item before the button located "clear", this message is: message ('hello'); / / in when-validate-item trigger
So this message is displayed when I click "ok", the cursor will be at the first item

979155 wrote:
I knew why the cursor has become at the first item text because when I click on email button "clear" message is displayed (my own message I put the code in the last item before the button located "clear", this message is: message ('hello'); / / in when-validate-item trigger
So this message is displayed when I click "ok", the cursor will be at the first item

If your are asking that, when the message display and you press ok then cursor goes to first item, it's not possible directly from when-validate-item trigger as it's only support unrestricted built-ins but go_item(); is restricted builtin.