TDBAdvSmoothDatePicker

Having a problem with the above control in either not allowing the user to enter a date manually or if I do allow that as I cannot find how to prevent how to set up a mask for MM/DD/YYY      My preference is user entry with editmask to control integrity.

There is no reference to this control in the manuals, at least not the DB version.

Assistance is appreciated.

EM

Forgot to say that I tried to use an editmaks !99/99/0000;1;_   and while that controls the entry integrity I also get the following  _1/_1/2017 for exampe when the day and month is a single digit..   Your assistance is greatly appreciated.


Hi, 


The TDBAdvSmoothDatePicker uses the FormatSettings as formatting capabilities. So to change the formatting you should use FormatSettings.ShortDateFormat. The Edit mask is not supported in this component, it is inherited from the base TAdvEdit component, and thus automatically published.

My apologies for my ignorance but I cannot find the property FormatSettings in this control.   

FormatSettings is a global record, which can be accessed in the constructor of the form:


http://www.delphibasics.co.uk/RTL.asp?Name=TFormatSettings

Is there a property of this control to ONLY allow the use of the calendar to enter a date ?   Sorry to ask these simple questions but cannot find in the documentation.

Hi, 


Yes you can set DBAdvSmoothDatePicker1.EditorEnabled := False; to disable editing of the date

Thank you that worked although I see it has to be set at RUNTIME as it does not work with setting at designtime,  why is this ?

EM

At designtime, it takes over the formatsettings specified in your operating system. (Language & Time settings at Windows control panel)

I am talking about the EDITORENABLED = FALSE,  that does not work setting at designtime only if set at runtime.  

Setting the EditorEnabled property in the object inspector works fine here, It can be set to False, yet the behaviour of not editable will only be available at runtime. It's unclear what you expect to happen at designtime?

I am setting EditorEnabled = False at designtime,  this still allows the user to EDIT the date using keystrokes.   I have to set TDBAdvSmoothDatePicker1.EditorEnabled = False at Runtime for it to actually prevent the user from editing the date using keyboard.  Setting at RunTime does not prevent the user from editing.  I am sorry if I did not explain correctly.


When setting EditorEnabled to false at designtime, starting the application, does not allow setting the focus on the datepicker nor does it allow keystrokes to be entered.

Ok so I wanted to see why we are getting diffrent results and either I found a bug or there is a reason for this.  I setup a unit with ONLY this control and EditorEnabled = False at Design time.   Ran the Unit and it works the control DOES NOT allow manual entry.

So I added a datasource and linged the control to a date on a table.  I ran it again.  Guess what now the control DOES allow manual entry.    So it seems like linking the Datasource and field somehow changes this. 

Third I set the EditorEnabled to False at RUNTIME and that does work.   Point is that it does not work when a datasource and field are attached if only set at design time.

Please look at this and tell me if I am missing something or there is a reason for this to work this way.

Thank you

EM

When it is databound, upon activation of the dataset, the EditorEnabled setting is sync'd with the bound DBField.ReadOnly setting. So, if you DB field is not readonly, set EditorEnabled in code after the dataset changed.  

Bruno thanks again for all of your time explaining this, I truly appreciate it.

I am not trying to be combative just having sharing my thoughts.  If we are using a DB control what else would the control be if not bound to a Database.  Now I realize it can work without binding to a field in a table but sounds contradictory to the point of a TDBAdv being used instead of a TAdv.  Also why use a control to tie to a field that is READ ONLY,  what would be the point of a date picker on a field that is read only ?  

Are you saying that if the field is READ ONLY but we use this control that we can still pick a date ?  Again appreciate your time and knowledge, I am just sharing what I see and asking for your view.  It seems like something just does not fit right.

THANKS AGAIN !!!!

Eddie M

When the DB field is readonly, both picking the date via the dropdown and via inplace editing will be disabled.