📄 uo_time_range.sru
字号:
$PBExportHeader$uo_time_range.sru
forward
global type uo_time_range from userobject
end type
type cbx_time from checkbox within uo_time_range
end type
type em_start_time from uo_date_editmask within uo_time_range
end type
type st_3 from statictext within uo_time_range
end type
type em_end_time from uo_date_editmask within uo_time_range
end type
type st_1 from statictext within uo_time_range
end type
end forward
global type uo_time_range from userobject
integer width = 2322
integer height = 132
long backcolor = 67108864
string text = "none"
long tabtextcolor = 33554432
long picturemaskcolor = 536870912
cbx_time cbx_time
em_start_time em_start_time
st_3 st_3
em_end_time em_end_time
st_1 st_1
end type
global uo_time_range uo_time_range
forward prototypes
public function date get_start_date ()
public function date get_end_date ()
public function boolean set_end_date (date adt_end_date)
public function boolean set_start_date (date adt_start_date)
public function boolean set_date_span (date adt_start_date, date adt_end_date)
public function boolean date_span_is_valid ()
public function boolean is_valid_date (string as_date)
public subroutine set_checked (boolean ab_status)
public function boolean get_checked ()
end prototypes
public function date get_start_date ();string ls_start_date
date ldt_start_date
ls_start_date = em_start_time.text
if is_valid_date(ls_start_date) then
return date(ls_start_date)
end if
return 1900-01-01
end function
public function date get_end_date ();string ls_end_date
date ldt_end_date
ls_end_date = em_end_time.text
if is_valid_date(ls_end_date) then
return date(ls_end_date)
end if
return 1900-01-01
end function
public function boolean set_end_date (date adt_end_date);string ls_end_date
ls_end_date = string(adt_end_date, "yyyy-mm-dd")
if ls_end_date = "1900-01-01" then
return false
end if
em_end_time.text = ls_end_date
return true
end function
public function boolean set_start_date (date adt_start_date);string ls_start_date
ls_start_date = string(adt_start_date, "yyyy-mm-dd")
if ls_start_date = "1900-01-01" then
return false
end if
em_start_time.text = ls_start_date
return true
end function
public function boolean set_date_span (date adt_start_date, date adt_end_date);if not set_start_date(adt_start_date) then
return false
end if
if not set_end_date(adt_end_date) then
return false
end if
return true
end function
public function boolean date_span_is_valid ();string ls_start_date, ls_end_date
ls_start_date = em_start_time.text
if not is_valid_date( ls_start_date) then
em_start_time.setfocus()
return false
end if
ls_end_date = em_end_time.text
if not is_valid_date( ls_end_date) then
em_end_time.setfocus()
return false
end if
return true
end function
public function boolean is_valid_date (string as_date);string ls_date
date ldt_date
ls_date = string(date(as_date), "yyyy-mm-dd")
if ls_date <> "1900-01-01" then
return true
end if
return false
end function
public subroutine set_checked (boolean ab_status);cbx_time.checked = ab_status
cbx_time.postevent(clicked!)
end subroutine
public function boolean get_checked ();return cbx_time.checked
end function
on uo_time_range.create
this.cbx_time=create cbx_time
this.em_start_time=create em_start_time
this.st_3=create st_3
this.em_end_time=create em_end_time
this.st_1=create st_1
this.Control[]={this.cbx_time,&
this.em_start_time,&
this.st_3,&
this.em_end_time,&
this.st_1}
end on
on uo_time_range.destroy
destroy(this.cbx_time)
destroy(this.em_start_time)
destroy(this.st_3)
destroy(this.em_end_time)
destroy(this.st_1)
end on
event constructor;set_date_span(1900-01-01, 1900-01-01)
end event
type cbx_time from checkbox within uo_time_range
event keydown pbm_keydown
integer x = 18
integer y = 16
integer width = 494
integer height = 96
integer taborder = 20
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "指定时间(&T)"
end type
event keydown;if key = KeyEnter! then
Send(Handle(this), 255, 9, 0)
Send(Handle(this), 256, 9, 0)
end if
end event
event clicked;if this.checked then
em_start_time.enabled = true
em_end_time.enabled = true
em_start_time.setfocus()
else
em_start_time.enabled = false
em_end_time.enabled = false
end if
end event
type em_start_time from uo_date_editmask within uo_time_range
integer x = 933
integer y = 16
integer width = 530
integer height = 96
integer taborder = 20
integer textsize = -12
boolean enabled = false
end type
event getfocus;call super::getfocus;selecttext(1,0)
end event
type st_3 from statictext within uo_time_range
integer x = 1518
integer y = 32
integer width = 206
integer height = 72
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "至(&T)"
boolean focusrectangle = false
end type
type em_end_time from uo_date_editmask within uo_time_range
integer x = 1755
integer y = 16
integer width = 530
integer height = 96
integer taborder = 20
integer textsize = -12
boolean enabled = false
end type
event getfocus;call super::getfocus;selecttext(1,0)
end event
type st_1 from statictext within uo_time_range
integer x = 695
integer y = 32
integer width = 197
integer height = 72
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "从(&F)"
boolean focusrectangle = false
end type
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -