Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
A control to set a time
ResourceFunction["TimeSetter"][] represents an interactive TimeObject expression initialized to Now. | |
ResourceFunction["TimeSetter"][t] is initialized to the time t. | |
ResourceFunction["TimeSetter"][Dynamic[x]] takes the setting to be the dynamically updated current value of x, with the value of x being reset if a different time is chosen. | |
ResourceFunction["TimeSetter"][d,gran] represents an interactive TimeObject expression at the time granularity gran. |
Appearance | Automatic | the overall appearance of the time setter |
Background | Automatic | time setter's background color |
BaseStyle | {} | base style specifications for the time setter |
Enabled | Automatic | whether the individual controls are active |
ImageMargins | Automatic | margins around the time setter |
ImageSize | Automatic | the overall size of the time detter |
LabelingFunction | Automatic | how to label the individual controls |
Display a time setter control:
In[1]:= |
Out[1]= |
Dynamically update the value of x:
In[2]:= |
Out[2]= |
Display a TimeObject to a specific granularity:
In[3]:= |
Out[3]= |
In[4]:= |
Out[4]= |
Initialize the interface using a supported time specification:
In[5]:= |
Out[5]= |
In[6]:= |
Out[6]= |
Use TimeSetter as a control within Manipulate:
In[7]:= |
Out[7]= |
Set the appearance to match a DateString specification:
In[8]:= |
Out[8]= |
Use a list of DateString specifications. Valid granularities automatically become controls while other strings display as written:
In[9]:= |
Out[9]= |
Use Rule to suggest the control type. None suppresses the control:
In[10]:= |
Out[10]= |
Use a control like SetterBar or PopupMenu instead of the default:
In[11]:= |
Out[11]= |
Use "Clock" to create an analog clock control with adjustable hands:
In[12]:= |
Out[12]= |
The clock appearance derives from ClockGauge. Specify options of ClockGauge to change the analog clock appearance:
In[13]:= |
Out[13]= |
Use a pure function to specify the appearance of an individual control. The first Slot is automatically filled with the appropriate Dynamic expression:
In[14]:= |
Out[15]= |
Use a pure function for the Appearance option to set the overall appearance. Named slots with time elements are replaced with the corresponding granularity control:
In[16]:= |
Out[17]= |
Change the background color:
In[18]:= |
Out[18]= |
Background is ignored if the Appearance is a pure function:
In[19]:= |
Out[19]= |
Use a named style:
In[20]:= |
Out[20]= |
Use box options to style specific controls:
In[21]:= |
Out[22]= |
By default, TimeSetter is enabled:
In[23]:= |
Out[23]= |
By setting Enabled→False, the interface is disabled but visible in its current state:
In[24]:= |
Out[24]= |
Add margins outside the time setter:
In[25]:= |
Out[25]= |
Set the width of the time setter:
In[26]:= |
Out[26]= |
The display clips if ImageSize is too small:
In[27]:= |
Out[27]= |
The individual granularity controls are automatically labeled using Tooltip. Hover over the individual controls to see the granularity that they affect:
In[28]:= |
Out[28]= |
Use LabelingFunction→None to suppress all labels:
In[29]:= |
Out[29]= |
Use directions Left, Right, Above and Below to place granularity control labels within the interface:
In[30]:= |
Out[30]= |
Use TimeZone to set the time zone specification of the underlying TimeObject:
In[31]:= |
Out[32]= |
Create a full 12-hour analog clock display:
In[33]:= |
Out[33]= |
The InputField controls default to 2-digit displays, prepending single-digit values with "0":
In[34]:= |
Out[34]= |
Each granularity control effectively uses DatePlus to update the TimeObject:
In[35]:= |
Out[36]= |
Coarser granularities update if finer granularities exceed their granularity range:
In[37]:= |
Out[37]= |
TimeSetter only accepts allowed time granularities:
In[38]:= |
Out[38]= |
Appearance components are case-sensitive. Any misspelled components pass through as written:
In[39]:= |
Out[39]= |
Correct any spelling mistakes to fix the display:
In[40]:= |
Out[40]= |
Improperly specified Appearance components display as a warning:
In[41]:= |
Out[41]= |
Correct any mistakes in the indicated component:
In[42]:= |
Out[42]= |
This work is licensed under a Creative Commons Attribution 4.0 International License