Tk Library Source Code

View Ticket
Login
EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA
Ticket UUID: fcce9df1f41789d9e19570028dc5fb518d3bc280
Title: tklib::dateentry is missing a 'set' method
Type: RFE Version: trunk (dateentry 0.93)
Submitter: ralfixx Created on: 2023-04-17 15:20:16
Subsystem: tklib :: widget :: dateentry Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2024-06-01 13:35:06
Resolution: Fixed Closed By: aku
    Closed on: 2024-06-01 13:35:06
Description:
The tklib::dateentry is a nice widget to select a date, and I can
readily query the date via the 'get' method.

However there currently is no convenient way to *set* the date (eg. at
program start to the selection of the last run).

I can use the methods of the entry, but this does not update the
calendar display:

  package require widget::dateentry
  pack [widget::dateentry .d -dateformat %Y-%m-%d]
  .d configure -state normal
  .d delete 0 end
  .d insert end 2020-10-10
  .d configure -state readonly

The dateentry now shows "2020-10-10", but when you open the calendar, it
shows todays' month instead of October 2020.

Using the -textvariable method is not reliable, it seems to be ignored
or interfers with the internals of the widget.

Proposed patch attached.
User Comments: aku added on 2024-06-01 13:35:06:

Fixed everything, see commit [ef3a4a7705].

New method `set`.

Changes to `-textvariable` are obeyed.

Updated docs.

Bumped to version 0.97.


aku added on 2024-06-01 12:41:06:

Ticket [832099c715] also notes that changes to the `-textvariable` are ignored. Closed that ticket as duplicate in favor of this one.

The textvariable is passed to the internal `widget::calendar`.

I suspect that the ignoring happens there.

Looking at the patch this is essentially packaging up the code from the description, with the limitation that the calendar is not updated, right ?

Looking into this now.


Attachments: