//读取配置
Function CheckStr:Boolean;
begin
	result:=True;
	if (edtCaption.text='') or (length(edtCaption.text)>6) then
	begin
		ShowMsg('不能填入空字符或者字符过长');
		result:=False;
	end;
end;

procedure InitSetting;
begin
  cbbDirection.ItemIndex:=GetSettingInt('DirctionIndex','0');
	edtCaption.text:=GetSetting('TabCaption','工具');
end;

//保存配置
procedure SaveSetting;
begin
	SetSetting('TabCaption',edtcaption.text);
  SetSettingInt('DirctionIndex',cbbDirection.ItemIndex);
end;

//--- Widget设置窗口初始化事件，当打开Widget设置窗口时会触发此事件 ---
procedure OnSettingInit;
begin
	self.height:=190;
  InitSetting;
end;

procedure OnSettingApply;
begin
	if CheckStr = True then
	SaveSetting;
end;

//--- Widget设置窗口关闭事件，当按下设置窗口的确定按钮时会触发此事件 ---
//通过设置返回值来改变是否允许确认,当result为False时不关闭设置窗口
function OnSettingClose(iResult):boolean;
var
  i:integer;
begin
	if CheckStr = True then
	begin
		SaveSetting;
		result:=true;
	end else
	begin
		result:=False;
	end;
end;

