Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

TElDateTimePicker, checked / unassigned / to use as a nullable datetime.

Hi,

I want to use the TElDateTimePicker control in a way where property checked is always the opposite of Unassigned.
When not checked, the control should show a blank, or maybe even better, a user defined "string".
I use it all over my application
I encapsulate it in a class with an interface INulldateTime, with "properties" DateTime: TDateTime, and IsNull: boolean.
It must also react automatically to set Unassigned = not checked, when the checkbox change.
At the moment I need code repeated all over to catch events and manually perform this.

Would it be possible to add some property to make the control work this way?

Best regards,
Louis

Comments

  • 9 Comments sorted by Votes Date Added
  • Can't precisely understand what you want, because you primarily describe your own code. Please describe your needs more precisely and plase mention our control's features which you need or, otherwise, don't like to use.
  • edited April 11 Posts: 22Vote Up0Vote Down
    Hi Eugene,

    A simplified change that would make this work for me, with only small changes to my code:

    Add properties, something like:
    property UncheckedText: string;
    property UseUncheckedText: Boolean;

    Make the control to display UncheckedText when Checked = false and UseUncheckedText = true;
    It would be best if it still works even when ShowCheckbox = false, i.e. if Checked is changed on the control, with or without a visible checkbox.

    It MAY be a bonus if e.g. color can also be set for when the control is unchecked.

    Regards,
    Louis
  • <Removed>
  • It DOES have a Checked: boolean property.
    It also has a ShowCheckbox: boolean property. 
  • I see control already has Unassigned: Boolean property for such cases. So, I will not duplicate things. Auto-connecting Checked and Unassigned is also not a good idea.

    You can provide a helper method inour code, such as AttachToPicker(APicker: TElDateTimePicker), which will setup all required events for you. Or do something similar.
  • B.T.W. my last suggestion:

    "A simplified change that would make this work for me, with only small changes to my code:" .. 

    does not involve "Auto-connecting Checked and Unassigned". 

    Just the ability to set the "text" shown to a user defined value when checked = true.
  • This concept (showing empty text) is implemented in Unassigned property. And thus, should not be related to Checked state.
    As for user defined unassigned text, I've added UnassignedText property for you, which, if specified, will have higher priority than UnassignedChar.
Sign In or Register to comment.