Jump to content

How To Select All Text In TUniDateTimePicker?


Frederick

Recommended Posts

  • 1 year later...
1 hour ago, Sanyi said:

I need this feature too. With UniEdit works SelectAll

Thanks

Hello

Can you try below code? It will work if kind = tUniTime or tUniDate.

procedure TMainForm.UniFormReady(Sender: TObject);
begin
  with UniDateTimePicker1, JSInterface do
  begin
    JSConfig('selectOnFocus', [True]);
  end;
end;

 

Link to comment
Share on other sites

On 10/16/2019 at 4:16 AM, Frederick said:

I would like to select all text in a TUniDateTimePicker in the OnEnter event

 

2 hours ago, Sanyi said:

I need this feature too

Hello,

For all Kinds.

MainForm.OnCreate event:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniDateTimePicker1 do
  begin
    if Kind in [tUniDate, tUniTime] then
      ClientEvents.UniEvents.Values['beforeInit'] := 'function beforeInit(sender, config){config.selectOnFocus = true}'
    else
    begin
      ClientEvents.UniEvents.Values['date.beforeInit'] := 'function date.beforeInit(sender, config){config.selectOnFocus = true}';
      ClientEvents.UniEvents.Values['time.beforeInit'] := 'function time.beforeInit(sender, config){config.selectOnFocus = true}';
    end;
  end;
end;

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...