

function justWidth()
{
  LockRefresh;
  bgmid.left = bgleft.width;
//  bgmid.Width =  txt.Width ;
  txtEdit.left =  txt.left;  
  txtEdit.top =  txt.top;
  txtEdit.Height =  txt.height;
  txtEdit.Width =  txt.Width;
  
//  bgmid.clipRight = 300 - txt.Width - 10;
  bgright.Left = bgleft.Width + bgmid.Width;
  widgetWidth = bgright.Left + bgright.Width;
  bgmid.Height = bgleft.Height;
  widgetHeight = bgleft.Height;
  UnLockRefresh;
  Refresh;  
} 


function widgetOnStart()
{
  txtEdit.Text = ReadIni( "txt" );
  if(txtEdit.Text=="") 
    txtEdit.Text = "×ùÓÒÃú"; 
  txt.caption = txtEdit.Text; 
  justWidth();
}

function widgetOnDBClick()
{
  ShowSetting;
  //justWidth();  
}

function txtOnMouseDown()
{
 
//  txtEdit.Width =  txt.Width;
//  txtEdit.Text = txt.caption;
//  txtEdit.Visible = true;
}

function bgmidOnMouseDown()
{
  txtEdit.Visible = false;
}

function widgetOnMouseDown()
{
  txtEdit.Visible = false;
}

function widgetOnDeActive()
{
  txtEdit.Visible = false;
}

function txtEditOnChange()
{
  txt.caption =  txtEdit.Text;
  txtEdit.Width =  txt.Width;
  justWidth();
  
  WriteIni( "txt",txtEdit.Text );
}



function bgleftOnClick()
{
  txtEdit.Visible = false;
}

function bgrightOnClick()
{
  txtEdit.Visible = false;
}

function bgmidOnClick()
{
  txtEdit.Visible = false;
}

function widgetOnInit()
{
  txt.fontName = GetSetting( "fontname" );
  txt.fontSize = GetSetting( "fontsize" );
  txt.fontColor = GetSetting( "fontcl" ); 
  bgmid.Width = GetSetting( "fontwidth" ); 
  justWidth(); 
}

function OnAllSettingsSaved()
{
  txt.caption = GetSetting( "txt" ); 
  widgetOnInit();
  SaveAllOption;
}