Jump to content

Recommended Posts

Posted

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 ?

Posted

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, //<-----------
Posted

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

 

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

Posted

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 ?

Posted

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.

Posted

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

Posted

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


Posted

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?

Posted

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.

Posted

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;
×
×
  • Create New...