andyhill Posted March 28, 2018 Posted March 28, 2018 Please show me how I can use a Mobile TimePicker (no date) - thanks.
Sherzod Posted March 28, 2018 Posted March 28, 2018 Hi, Can you try this approach?: http://forums.unigui.com/index.php?/topic/5760-datetimepicker-for-sencha-touch/
andyhill Posted March 29, 2018 Author Posted March 29, 2018 Followed your directions HOWEVER I do not want Month / Day / Year, I only want Hours / Minutes
andyhill Posted March 29, 2018 Author Posted March 29, 2018 Thanks, that got rid of Day / Month / Year tumblers leaving only the Hour / Minute tumblers BUT they have no Captions to advise user what they are ?
Sherzod Posted March 29, 2018 Posted March 29, 2018 Thanks, that got rid of Day / Month / Year tumblers leaving only the Hour / Minute tumblers BUT they have no Captions to advise user what they are ? Try this: config.picker = Ext.create('Ext.ux.picker.DateTime', { useTitles: true, //<-----------
andyhill Posted March 30, 2018 Author Posted March 30, 2018 I have wrestled with this over and over. The Picker does not accept or return the time (only the date) even though when opened you can see and change the time visually - it is not stored ? READ TimeFrom (TUnimDatePicker) var d1: TDateTime; myYear1, MyMonth1, MyDay1, myHour1, myMin1, mySec1, myMilli1: Word; begin try d1:= TimeFrom.Date; DecodeDateTime(d1, myYear1, MyMonth1, MyDay1, myHour1, myMin1, mySec1, myMilli1); ... WRITE TimeFrom (TUnimDatePicker) DecodeDate(UniMainModule.tblCart.FieldByName('BookingDate').AsDateTime, myYear1, MyMonth1, MyDay1); DecodeTime(UniMainModule.tblCart.FieldByName('BookingFromTime').AsDateTime, myHour1, myMin1, mySec1, myMilli1); TimeFrom.Date:= EncodeDateTime(myYear1, MyMonth1, MyDay1, myHour1, myMin1, mySec1, myMilli1); Help required ASAP.
Sherzod Posted March 30, 2018 Posted March 30, 2018 I have wrestled with this over and over. The Picker does not accept or return the time (only the date) even though when opened you can see and change the time visually - it is not stored ? READ TimeFrom (TUnimDatePicker) var d1: TDateTime; myYear1, MyMonth1, MyDay1, myHour1, myMin1, mySec1, myMilli1: Word; begin try d1:= TimeFrom.Date; DecodeDateTime(d1, myYear1, MyMonth1, MyDay1, myHour1, myMin1, mySec1, myMilli1); ... WRITE TimeFrom (TUnimDatePicker) DecodeDate(UniMainModule.tblCart.FieldByName('BookingDate').AsDateTime, myYear1, MyMonth1, MyDay1); DecodeTime(UniMainModule.tblCart.FieldByName('BookingFromTime').AsDateTime, myHour1, myMin1, mySec1, myMilli1); TimeFrom.Date:= EncodeDateTime(myYear1, MyMonth1, MyDay1, myHour1, myMin1, mySec1, myMilli1); Help required ASAP. http://forums.unigui.com/index.php?/topic/5760-datetimepicker-for-sencha-touch/&do=findComment&comment=41359
andyhill Posted March 30, 2018 Author Posted March 30, 2018 All code is in place as instructed. The Reading and Writing of the Time values always results in ZERO. Is it possible the Time Picker only works if the platform is 'mobile' making /m (Desktop Emulation) invalid ?
andyhill Posted March 31, 2018 Author Posted March 31, 2018 I have proved that on both Desktop Emulation (/m) and Mobile (iOS) the Time Values are not persistent - that is the modified TDatePicker (that now handles time) has no way of receiving the Time Values from Delphi (set the time) as well as has no way to have it's Time Values read by Delphi ? Using an ajax event to catch when the Time changes does not allow one to program the time into the picker in the first place plus it is messy to catch the time change and store elsewhere when it really should have been bound to the DateTime object - not forgetting to mention what happens if they do not change the time. Please advise how to resolve ASAP as this is very urgent - thanks in advance.
andyhill Posted April 1, 2018 Author Posted April 1, 2018 My project is too big so I tried to quickly knock this up 64bit Desktop / Mobile (hybrid). Please copy the 2 JavaScript files into the EXE Directory. Debug and trace set DatePicker (no time is set) and read DatePicker (no time is read). Project1.zip
andyhill Posted April 1, 2018 Author Posted April 1, 2018 The one you told me to use for Tokyo 10.2 uni-1.0.0.1423 unim-1.0.0.1423 touch-2.4.2 ext-4.2.5.1763
andyhill Posted April 1, 2018 Author Posted April 1, 2018 Here it is again, this time Mobile W32. Please copy the 2 JavaScript files into the EXE Directory. Project1.zip
Sherzod Posted April 8, 2018 Posted April 8, 2018 Hi, Sorry for delay, At the moment, I think that you need to use a local variable to store the date and time Will this solution acceptable to you?
andyhill Posted April 8, 2018 Author Posted April 8, 2018 Yes. I can live with a Local Variable that can be updated by the Picker's Change Event HOWEVER how do I pre-load the Picker's Time with the Local Variables original Time ? Please show me in code - thanks.
Sherzod Posted April 9, 2018 Posted April 9, 2018 For example like this: 1. A global variable: dtPicker: TDateTime; 2. function beforeInit(sender, config) { config.picker = Ext.create ( 'Ext.ux.picker.DateTime', { useTitles: true, doneButton: true, cancelButton: true, minuteInterval: 30, slotOrder: ['year', 'month', 'day', 'hour', 'minute'], toolbar: { //items : datetimepickettoolbaritems } } ); Ext.Date.patterns={CustomFormat: "d/m/Y H:i"}; config.dateFormat=Ext.Date.patterns.CustomFormat; //<---------------- } 3. procedure TMainmForm.UnimFormShow(Sender: TObject); var Fmt: TFormatSettings; begin Fmt.ShortDateFormat:='dd/mm/yyyy'; Fmt.DateSeparator :='/'; Fmt.LongTimeFormat :='hh:mm'; Fmt.TimeSeparator :=':'; dtPicker := Now; UnimDatePicker1.JSInterface.JSCall('setValue', [FormatDateTime('', dtPicker, Fmt)]); end; 4. procedure TMainmForm.UnimDatePicker1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var Fmt: TFormatSettings; begin if EventName = '_timeChange' then begin Fmt.ShortDateFormat:='dd/mm/yyyy'; Fmt.DateSeparator :='/'; Fmt.LongTimeFormat :='hh:mm'; Fmt.TimeSeparator :=':'; dtPicker := StrToDateTime(Params.Values['val'], Fmt); end; end;
Recommended Posts