604
社区成员




$PBExportHeader$uo_editmask.sru
forward
global type uo_editmask from editmask
end type
end forward
global type uo_editmask from editmask
integer width = 457
integer height = 128
integer textsize = -9
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = roman!
string facename = "Times New Roman"
long textcolor = 33554432
string text = "none"
borderstyle borderstyle = stylelowered!
string mask = "##0"
boolean spin = true
string minmax = "1~~200"
event ue_change pbm_enchange
end type
global uo_editmask uo_editmask
type variables
boolean ib_change
end variables
event ue_change;long ll_min, ll_max
ll_min = long(left(minmax, pos(minmax, '~~') - 1))
ll_max = long(mid(minmax, pos(minmax, '~~') + 1))
if not ib_change and ll_min > 0 and ll_max > 0 then
ib_change = true
int li_pos
li_pos = selectedstart( )
if long(text) > ll_max or long(text) < ll_min then
text = left(text, li_pos - 2) + mid(text, li_pos)
this.selecttext(li_pos - 1,0)
end if
ib_change = false
end if
end event
on uo_editmask.create
end on
on uo_editmask.destroy
end on
forward
global type uo_editmask from editmask
end type
end forward
global type uo_editmask from editmask
integer width = 457
integer height = 128
integer textsize = -9
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = roman!
string facename = "Times New Roman"
long textcolor = 33554432
string text = "none"
borderstyle borderstyle = stylelowered!
maskdatatype maskdatatype = datemask!
string minmax = "1~~200"
event ue_change pbm_enchange
end type
global uo_editmask uo_editmask
type variables
//boolean ib_change
Public:
Boolean ib_Validatebound = False//驗證範圍
String is_min,is_max//範圍值
end variables
forward prototypes
public function boolean uf_validatebound ()
end prototypes
event ue_change;//long ll_min, ll_max
//ll_min = long(left(minmax, pos(minmax, '~~') - 1))
//ll_max = long(mid(minmax, pos(minmax, '~~') + 1))
//if not ib_change and ll_min > 0 and ll_max > 0 then
// ib_change = true
// int li_pos
// li_pos = selectedstart( )
// if long(text) > ll_max or long(text) < ll_min then
// text = left(text, li_pos - 2) + mid(text, li_pos)
// this.selecttext(li_pos - 1,0)
// end if
// ib_change = false
//end if
Integer li_pos
IF Not uf_validatebound() THEN
li_pos = selectedstart( )
THIS.Text = Left(THIS.Text, li_pos - 2) + mid(THIS.Text, li_pos)
THIS.selecttext(li_pos - 1,0)
END IF
end event
public function boolean uf_validatebound ();any la_min,la_max,la_value
IF Not ib_Validatebound THEN Return True
CHOOSE CASE THIS.MaskDatatype
CASE datemask!
la_value = Date(THIS.Text)
la_min = Date(is_min)
la_max = Date(is_max)
CASE datetimemask!
la_value = DateTime(THIS.Text)
la_min = DateTime(is_min)
la_max = DateTime(is_max)
CASE decimalmask!
la_value = Dec(THIS.Text)
la_min = Dec(is_min)
la_max = Dec(is_max)
CASE numericmask!
la_value = long(THIS.Text)
la_min = long(is_min)
la_max = long(is_max)
CASE stringmask!
la_value = THIS.Text
la_min = is_min
la_max = is_max
CASE timemask!
la_value = Time(THIS.Text)
la_min = Time(is_min)
la_max = Time(is_max)
CASE ELSE
Return False
END CHOOSE
Return (la_value >= la_min AND la_value <= la_max)
end function
on uo_editmask.create
end on
on uo_editmask.destroy
end on
event constructor;//默認為最小值
THIS.Text = is_min
//設置範圍
THIS.Minmax = is_min+"~~"+is_max
end event