>> Please note: I want to set the focus to the 1st line in the text, not at the bottom!
- Code: Select all
function fxSetJavaScriptFocus: string;
var
lJS : TStringList;
begin
lJS := TStringList.Create;
try
lJS.Add('');
lJS.Add('function setFocus()');
lJS.Add('{');
lJS.Add(' editor = TIWHTMLEDITMESSAGEgetIFrame(''TIWHTMLEDITMESSAGEeditorDiv'');');
lJS.Add(' editor.focus();');
lJS.Add('}');
Result := lJS.Text;
finally
lJS.Free;
end;
end;
begin
self.JavaScript.Text := fxSetJavaScriptFocus;
AddToInitProc('window.onLoad=setFocus();');
end;