PowerBuilder 文本控件显示提示内容

效果图:
在这里插入图片描述
1、创建Standard Visual标准系统控件,选择singlelineedit控件,命名为uo_contenthint
2、复制下面代码,替换uo_contenthint对象的Edit Source中的语法

forward
global type uo_contenthint from singlelineedit
end type
end forward

global type uo_contenthint from singlelineedit
integer width = 457
integer height = 128
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type
global uo_contenthint uo_contenthint

type variables
string is_con='' //存储提示内容
boolean ibb_bool=true //判断是否是输入内容还是提示内容
//il_color 输入文字内容颜色 , il_color_2 提示内容文字颜色
long il_color=33554432,il_color_2=3234324
end variables
forward prototypes
public subroutine uo_initial (string as_msg)
end prototypes

public subroutine uo_initial (string as_msg);this.text=as_msg
is_con=as_msg
this.textcolor=il_color_2
end subroutine

on uo_contenthint.create
end on

on uo_contenthint.destroy
end on

event getfocus;if ibb_bool then
	this.text=''
	this.textcolor=il_color
end if
end event

event losefocus;if ibb_bool then
	this.text=is_con
	this.textcolor=il_color_2
end if
end event

event modified;if trim(this.text)='' then
	ibb_bool=true
else
	ibb_bool=false
end if

end event


1、获取输入的内容

if sle_3.ibb_bool then
else
	messagebox("",sle_3.text)
end if
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值