User Tools

Site Tools


using_20the_20date_20and_20time_20picker

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

using_20the_20date_20and_20time_20picker [2018/03/31 13:19]
127.0.0.1 external edit
using_20the_20date_20and_20time_20picker [2018/04/15 18:49] (current)
tbest3112 Added syntax highlighting
Line 4: Line 4:
 ==== Output window ==== ==== Output window ====
 \\  To display a Date/Time picker on the output window use code similar to the following:​\\ \\  \\  To display a Date/Time picker on the output window use code similar to the following:​\\ \\ 
 +<code bb4w>
         INSTALL @lib$+"​WINLIB5"​         INSTALL @lib$+"​WINLIB5"​
         ICC_DATE_CLASSES = &100         ICC_DATE_CLASSES = &100
Line 13: Line 14:
  
         hdtp% = FN_createwindow("​SysDateTimePick32",​ "",​ x%, y%, cx%, cy%, 0, style%, 0)         hdtp% = FN_createwindow("​SysDateTimePick32",​ "",​ x%, y%, cx%, cy%, 0, style%, 0)
 +</​code>​
 Here **x%,y%** is the position at which the Date/Time picker should be displayed, **cx%,cy%** is the size of the Date/Time picker window and **style%** is one of the following values (the figures in brackets are suggested window sizes for the different styles):\\ \\  Here **x%,y%** is the position at which the Date/Time picker should be displayed, **cx%,cy%** is the size of the Date/Time picker window and **style%** is one of the following values (the figures in brackets are suggested window sizes for the different styles):\\ \\ 
  
Line 19: Line 21:
   * **9** - to display a time picker (cx%=72, cy%=20)   * **9** - to display a time picker (cx%=72, cy%=20)
 \\  To read the currently selected date or time from the control use code similar to the following:​\\ \\  \\  To read the currently selected date or time from the control use code similar to the following:​\\ \\ 
 +<code bb4w>
         DIM systemtime{Year{l&,​h&​},​ Month{l&,​h&​},​ DayOfWeek{l&,​h&​},​ Day{l&,​h&​},​ \         DIM systemtime{Year{l&,​h&​},​ Month{l&,​h&​},​ DayOfWeek{l&,​h&​},​ Day{l&,​h&​},​ \
         \              Hour{l&,​h&​},​ Minute{l&,​h&​},​ Second{l&,​h&​},​ Milliseconds{l&,​h&​}}         \              Hour{l&,​h&​},​ Minute{l&,​h&​},​ Second{l&,​h&​},​ Milliseconds{l&,​h&​}}
Line 31: Line 34:
         minute% = systemtime.Minute.l&​         minute% = systemtime.Minute.l&​
         second% = systemtime.Second.l&​         second% = systemtime.Second.l&​
 +</​code>​
 To close the control use the following code:\\ \\  To close the control use the following code:\\ \\ 
 +<code bb4w>
         PROC_closewindow(hdtp%)         PROC_closewindow(hdtp%)
 +</​code>​
 \\  \\ 
 ==== Dialogue box ==== ==== Dialogue box ====
 \\  To display a Date/Time picker in a dialogue box use code similar to the following:​\\ \\  \\  To display a Date/Time picker in a dialogue box use code similar to the following:​\\ \\ 
 +<code bb4w>
         INSTALL @lib$+"​WINLIB2"​         INSTALL @lib$+"​WINLIB2"​
         ICC_DATE_CLASSES = &100         ICC_DATE_CLASSES = &100
Line 57: Line 64:
  
         PROC_showdialog(dtpdlg%)         PROC_showdialog(dtpdlg%)
 +</​code>​
 Where **style%** has one of the values listed above. Again the size of the Date/Time picker control will need to be modified according to the style, but here the size is specified in dialogue box units rather than pixels (see the main [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​dlgitem|BBC BASIC for Windows documentation]]).\\ \\  To read the currently selected date or time from the control when the OK button is clicked use code similar to the following:​\\ \\  Where **style%** has one of the values listed above. Again the size of the Date/Time picker control will need to be modified according to the style, but here the size is specified in dialogue box units rather than pixels (see the main [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​dlgitem|BBC BASIC for Windows documentation]]).\\ \\  To read the currently selected date or time from the control when the OK button is clicked use code similar to the following:​\\ \\ 
 +<code bb4w>
         click% = 0         click% = 0
         ON SYS click% = @wparam% AND &FFFF : RETURN         ON SYS click% = @wparam% AND &FFFF : RETURN
Line 83: Line 92:
  
         PROC_closedialog(dtpdlg%)         PROC_closedialog(dtpdlg%)
 +</​code>​
 You will want to use **ON ERROR** and **ON CLOSE** statements to ensure that "​PROC_closedialog"​ is called even if the program is terminated unexpectedly. You will want to use **ON ERROR** and **ON CLOSE** statements to ensure that "​PROC_closedialog"​ is called even if the program is terminated unexpectedly.
using_20the_20date_20and_20time_20picker.txt ยท Last modified: 2018/04/15 18:49 by tbest3112