HEllo i would like to change the text of a Field if it gets the focus
Code
- procedure TCrTableForm.WPRichText1EditFieldFocus(Sender: TObject; const InspName: string; Enter: Boolean; FieldObject: TWPTextObj; var Abort: Boolean);
- var
- value : string;
- begin
- if inspName = 'PROZENT' then begin
- if Enter then begin
- value := '12';
- end
- else begin
- value := '12,0 %';
- end;
- FieldObject.EmbeddedText := value;
- WPRichText1.Refresh;
- end;
- end;
But i think it is not correct to do it this way, because if i do it, i didn't get evere FocsuEnter and FocusLose Event ...
if i remove the WPRichText1.Refresh, i get ALL Events, with this code i sometime didn't get the next FocusChange event.
And what is the best practise, to select the whole text if i focus a field?