Jump to content

How To Determine If Calendar Dropped Down Or Closed?


Frederick

Recommended Posts

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniDateTimePicker1, JSInterface do
  begin
    JSAddListener('collapse', JSFunction('', 'ajaxRequest('#1', "collapse");'));
    JSAddListener('expand', JSFunction('', 'ajaxRequest('#1', "expand");'));
  end;
end;

Then in OnAjaxRequest of component, capture the events.

 

if EventName ='...' then
begin
  ... := Params.Values['...'];
end

 

Link to comment
Share on other sites

11 hours ago, Hayri ASLAN said:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniDateTimePicker1, JSInterface do
  begin
    JSAddListener('collapse', JSFunction('', 'ajaxRequest('#1', "collapse");'));
    JSAddListener('expand', JSFunction('', 'ajaxRequest('#1', "expand");'));
  end;
end;

 

Hi Hayri,

Delphi is throwing up the attached error at the following line:-

JSAddListener('collapse', JSFunction('', 'ajaxRequest('#1', "collapse");'));

datStarting is my control's name.

P.S.   When you refer to OnAjaxRequest event of the control, you are actually referring to OnAjaxEvent?

nodefaultjsobj.png

Link to comment
Share on other sites

1 hour ago, Frederick said:

Any help on the above?

What problem do you have? Please make a simple testcase.

On 12/5/2019 at 8:54 AM, Frederick said:

P.S.   When you refer to OnAjaxRequest event of the control, you are actually referring to OnAjaxEvent?

Yes.

ajaxRequest -> OnAjaxEvent

Link to comment
Share on other sites

Frederick,

insert the call in UniFormShow not in UniFormCreate

procedure TMainForm.UniFormShow(Sender: TObject);
begin
  with UniDateTimePicker1, JSInterface do
  begin
    JSAddListener('collapse', JSFunction('', 'ajaxRequest('#1', "collapse");'));
    JSAddListener('expand', JSFunction('', 'ajaxRequest('#1', "expand");'));
  end;
end;

and using OnAjaxEvent to read message

 

if EventName ='...' then
begin
  ... := Params.Values['...'];
end

 

It works

Angelo

 

Link to comment
Share on other sites

7 hours ago, Sherzod said:

What problem do you have? Please make a simple testcase.

Yes.

ajaxRequest -> OnAjaxEvent

The code now works (thanks to Azago) when it is placed in the form's OnShow event. Hayri earlier replied that the code was to in the form's OnCreate event and that caused UniGUI to throw an error.

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...