How to change date in onChangeEvent? - delphi

I need to react at TDateTimePicker.OnChangeEvent on date change. Display dialogs like "Unsaved changes will be lost" with buttons OK, Cancel. If the user press Cancel button I want to reset back the original date.
Unfortunatelly I can't change the date from that event. Change is ignored.
More detailed description:
User change the date in DateTimePicker (by keyboard) or Opens the calendar and pick a date
OnChange event is fired (calendar maybe still open)
I display the MessageDialog and if user press "Cancel" I want to restore date. Eg. close the calendar and restore date.

It is partially solved by user LU RD - see comments "Restore the value in the OnCloseUp event". It works for choosing date from a calendar.
If user change date directly in edit using keyboard it can be changed directly in onChangeEvent.
So combination of setting original (or any other date) in onCloseUp and onChange event is enough.

Related

How to get textfield value in App Inventor without form submission?

I want to know the event in blocks section using which the entered text value can be obtained without a form submission through button.
Let's say user inputs text in mobile phone through keyboard and presses enter. In this case I want some event to trigger and get the value that user entered.
There are 2 events available like lostfocus and gotfocus.
Will these work? Or is there any other good approach for getting text value on pressing enter?
Unfortunately there is no such event like OnEnterPressed available in MIT App Inventor and the events LostFocus and GotFocus will not work in this case.
What you currently can do is
use a button and use the Button.Click event, or
create your own custom keyboard, see also this example
Currently there is a limitation for App Inventor extensions, which only can be used for non-visible components. Later as soon as also visible components are doable, then you could write your own textbox extension and add an event yourself.
Edit concerning the new question in the comments about different screens:
Use different screens wisely
Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantages, because in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed...
You can insert a Clock component that monitors the TextBox1.Text. When it triggers, it checks if the TextBox1.Text has changed and saves it to a variable. When it triggers again, it compares the variable with TextBox1.Text. After the user finishes typing, the variable and TextBox1.Text will be equal and then you can trigger the event like you eanted when the user pressed Enter.
Hope this helps!

How to pick the pre selected date/time

I am building an iOS app and in this app I got a datepicker (timepicker mode).
When user clicks the button and the picker opens one date/time is "selected". For example 1:20 am (I use 5 minutes intervals) but when the user dismiss the picker it picks the real time which is 1:23 am. If I pick another date/time by scrolling and then selects 1:20 am again I get that time. But not if I donĀ“t do any active selection.
My question is this. How can I get the time that is selected by default (if no user interaction is done)?
Thankful for all help!

jquery mobile calendar opens other calendar when date is set

i have 3 datebox fields one under another. When i open first calendar, its SET DATE button comes over the 3rd field. So when i tap on the SET DATE it also gets click on the 3rd field and its calendar opens up...
Right now i am doing this, but its not a good idea and also doesn't works in all browsers
if(passed.method === 'close'){ // If first field calendar close
setTimeout(function(){
$(3rd field calendar).datebox('enable');
$(3rd field calendar).blur();
$(3rd field calendar).datebox('close');
}, 500);
}
Kindly suggest

Closing the Mobiscroll Datepicker Explicitly

My application has the session timeout, the application goes to the login page after 15 mins of inactive. The problem i am facing is when the user opened the Mobiscroll date picker and remain in the same page for the 15 mins, the Session timeout alert shows, but the mobiscroll date picker remain in the login page also.
Is there any way to close the mobiscroll date picker explicitly.
$('.dw').detach();
to delete the mobiscroll screen from the page.
$('.dwo').detach(); is to delete the mobiscroll from the DOM.
You can also trigger the click event on the "Cancel" button, which would be the same as if the user had manually closed the datepicker:
$("#dw_cancel").click();

Hover-to-click on jQuery UI datePicker 'next month' and 'prev month' not working

I have a calendar which is meant to look much like the calendar in Outlook. There is a big field representing the hours in a day, and there is a date navigator. The navigator is the jQuery UI Datepicker.
I want users to be able to navigate to a new day by clicking on a date in the datepicker, but also to be able to drag appointments over the datepicker and drop them on a specific date. I have that working now.
I also want users, while they are dragging an appointment, to be able to move to next or previous month simply by hovering over the datepicker. So I've added a mouseenter and mouseleave event: one runs a setInterval function which sends a click every 1,5 seconds; the other cancels the interval function.
This is where all sorts of things go wrong. As soon as one click has been triggered, the mouseleave function no longer works: in other words, the datepicker keeps flipping over to another month every 1,5 seconds.
It seems that the datePicker interferes, or that the click event causes other things to go wrong. What can I do?
It sounds like your event listeners are been overwritten by the jQuery-UI Datepicker states. It you look at the source of the date picker, every time it changes state it re-declares its event listeners. Thats all I can say without looking at your source.
Post your source and I'll try to fix it for you. It may be necessary to monkey patch the Datepicker.

Resources