For anyone attempting to use this date picker in their own BASIC code, I have some notes and additions that may be helpful for others:
To incorporate the Picker library into my own collection of Basic libraries I:
- created a new library called "Pickers" and named with module within it "CalM" and then copied and pasted the contents of the "CalM" from JeJe's document into the module I just created.
- exported the "PCalD" dialog from the document into the folder created for my new "Pickers" library. If you have not knowingly changed the location of the libraries in MyMacros, then these will be in the user-specific application data folder, under ".../user/basic/Pickers"
- opened the "PCalD.xdl" file in a text editor and replaced all instances of "location=document" with "location=application", and saved. Doing this will make sure that all event handles (like mouse click events) call the new "Pickers" library instead of the old one in the Writer document.
- imported the "PCalD" dialog I just edited into the the new "Pickers" library
I also made a couple code changes to improve the usability: I changed the DayClick routine so that it does not close the dialog if a blank day was clicked, and have it updating the title of the dialog so that after closing you can check the Title of the dialog to see if it was closed via a date click OR via the close (X) button.
- Code: Select all Expand viewCollapse view
sub DayClick(oEvt) 'day button click
If oEvt.Source.Text = "" Then
Exit Sub
End If
popUPCal.endexecute
popUPCal.setTitle("Date Picked")
end sub
Code to check if the dialog was closed with the close button or not:
- Code: Select all Expand viewCollapse view
dDate = ShowDatePicker()
If popUPCal.Title = "Date Picked" Then
MsgBox "Picker closed upon selecting " & dDate
Else
MsgBox "Picker closed without selecting a date"
End If