Calendar component won't accept already selected date

I have a textbox that displays the date from an SQL query. Most of the time, this value is NULL, so the textbox is blank. If the user needs to set this date, then they click on the textbox and a calendar component is made visible and replaces the textboxes in that area. The user selects the date from the calendar and the calendar visibility is set to 0, the db is updated and the textbox gets the date value to display. All is good.

The problem is that if the date is already set to the desired date on the calendar when the user opens it, selecting the currently selected date does not do anything. I tried turning the OK button on in the properties, but unless the date is changed, the OK button does not do anything. The user has to click on a different date, then reopen the calendar and click on the correct date.

By the way, I am using this method if textbox replaced by calendar instead of using the popup calendar because the value is almost always Null and the users are confused if a date is display in this spot.

How does this part work?

Hi Carl,
Here is the code under the calendar propertyChange. Basically when a date is selected, that value is written into the label and database, then the calendar disappears.

if event.propertyName == 'formattedDate':
    newVal = event.source.formattedDate
    bbtid = event.source.parent.getComponent('txtAuto').text
    fpmi.db.runPrepStmt("UPDATE dbo.BatchFiltration SET fldProjPackDate = (?) WHERE BBTID = (?)",[newVal,bbtid])
    event.source.parent.getComponent('lblPackDate').visible = 1
    event.source.parent.getComponent('lblPackDate').text = newVal
    event.source.visible = 0

Ah, thats the problem. When they select the date that is already selected - no property change occurs, because, well, the property didn’t change! I’d just put your own “OK” button below the calendar, and move your code into the button.

Thanks Carl,
I’ll give that a try.