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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...