Frederick Posted December 4, 2019 Share Posted December 4, 2019 I have a TUniDateTimePicker control. When the button is clicked and the calendar drops down, how do I know that it has happened? Conversely, how do I tell if the calendar has been closed by the user? -- Frederick (UniGUI Complete - Professional Edition 1.90.0.1514) Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted December 4, 2019 Share Posted December 4, 2019 Hi You can use expand and collapse events in ExtEvents. Link to comment Share on other sites More sharing options...
Frederick Posted December 4, 2019 Author Share Posted December 4, 2019 2 hours ago, Hayri ASLAN said: Hi You can use expand and collapse events in ExtEvents. Do you have example code? Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted December 4, 2019 Share Posted December 4, 2019 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 More sharing options...
Frederick Posted December 5, 2019 Author Share Posted December 5, 2019 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? Link to comment Share on other sites More sharing options...
Frederick Posted December 6, 2019 Author Share Posted December 6, 2019 Any help on the above? Link to comment Share on other sites More sharing options...
Sherzod Posted December 6, 2019 Share Posted December 6, 2019 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 More sharing options...
azago Posted December 6, 2019 Share Posted December 6, 2019 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 More sharing options...
Frederick Posted December 6, 2019 Author Share Posted December 6, 2019 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 More sharing options...
Frederick Posted December 6, 2019 Author Share Posted December 6, 2019 6 hours ago, azago said: insert the call in UniFormShow not in UniFormCreate Thanks. The change did the trick and the code now works. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now