Monday, April 9, 2007

[新版本發佈] 兩項新功能增加

檔案大小: 882KB

Information

1.
中文
視窗透明度可以由使用者指定
設定方式: 請至 Misc -> Transparency 中選擇喜好的視窗透明度

English:
Now, you can set the transparency of Longman Dictionary Helper.
Usage: Please refer the Misc->
Transparency tab and choose the favor transparency level.


2.
中文
Auto Maintain the Focus 功能時間, 可以自由調整
設定方式:請至 Delay Time-> Auto Focus Delay 中, 選擇喜好的時間

說明:

有時候, 我們要使用 Longman Dictionary 的交互查詢功能時, 可能會因為 Helper 的 maintain the focus 功能, 而造成困擾. 這項困擾大部分的原因是 預設時間 5 秒鐘太短了. 設定太長的時間, 又無法滿足連續輸入的需求. 最好的方法是自動檢測使用者是否正在使用 Longman Dictionary 上面的功能. 現在暫時先用使用者設定的方式, 先解決部分使用者的問題.

English:
The auto-focus delay time can be adjusted, right now.
Usage: Please refer the Delay Time-> Auto Focus Delay tab and choose the favor delay time.

Description:

Sometimes, the default delay time for the periodly maintaining focus function is too short. Especially when a user want to use Longman Dictionary's function to do further searching the word, default value 5 million second is not enough to do more operations. Now, we leave the waiting time option to the user. You can setup the default delay time to temporally solve this problem. However, the finally solution is creating a system to detect the user whether use the original Longman Dictionary's function. If yes, disable the auto-focus function. If no, resume the function.

[Implement] Auto Focus Delay 使用者設定實作



Step 1: 設定 Auto Focus Delay (Combox 元件) 初值



// 設定 AutoFocusTime 初值
long AutoFocusTimeDefault=5000;
// 取得目前 AutoFocusTime 的值
dlg->lAutoFocusTime=get_AnyLongDefalutValue(thdDlg->myList,_T("lAutoFocusTime"),lAutoFocusTimeDefault);
_ltot(dlg->lAutoFocusTime,buffer,10);
obj=(CComboBox *)dlg->GetDlgItem(IDC_AutoFocus);
// 設定 AutoFocus下拉的每一個項目值
SetComboxDefalutValue(obj,lAutoFocusTimeDefault,1000,20);
obj->SetWindowText(buffer);

Step 2: 立即設定使用者的資料

// 取得使用者選擇的資料
UpdateComboxValue_Long(dlg,IDC_AutoFocus,&dlg->lAutoFocusTime);
// 回存 Data.txt
Update_AnyLongValue(thdDlg->myList,_T("lAutoFocusTime"),dlg->lAutoFocusTime);
thdDlg->ModifyMainFocusTime(dlg->lAutoFocusTime);

[Implement] 最簡單的 Slider Control 範例


功能需求: 拉動 slider bar, 連動 CEdit Control 內容自動變化



Step 1: 新增類別成員
CSliderCtrl *m_Slider2;
CString m_Slidervalue;

Step 2: 在 OnInitDialog Method 中加入初始化的程式碼
BOOL CMisc::OnInitDialog(){
// 事件處理:
// 使用 IDC_SLIDER1 , 拉動 slider 自然就會將訊號送給 parent 的 OnHScroll 事件
m_Slider2=(CSliderCtrl*)this->GetDlgItem(IDC_SLIDER1);
m_Slider2->SetRangeMin(1, false); // 設定 最小值
m_Slider2->SetRangeMax(100, false);// 最大值
m_Slidervalue = _T("1"); // 設定最初的資料
UpdateData(FALSE);
return TRUE;
}

Step 3: 加入動態資料交換設定, 連結 拉桿與顯示字串的資料轉換工作
void CMisc::DoDataExchange(CDataExchange* pDX){
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SLIDER1, *m_Slider2);
DDX_Text(pDX, IDC_EDIT1, m_Slidervalue);
}

Step 4: 設定拉桿事件, 當使用者拉動拉桿, 顯示字串自動更新
BEGIN_MESSAGE_MAP(CMisc, CResizablePage)
ON_WM_HSCROLL()
END_MESSAGE_MAP()

void CMisc::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if(nSBCode == TB_THUMBTRACK) {
m_Slidervalue.Format(_T("%ld"), nPos);
UpdateData(false);
}

else {
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}

}

Longman Dictionary Helper 實作部分
     // 讀取目前資料庫中透明度的資料
long lAlphaValueDefalut=70;
TCHAR strDefalutValue[20];
_ltot(lAlphaValueDefalut,strDefalutValue,10);
CString strDefaultLongValue=get_ParValue(thdDlg->myList, _T("lAlphaValue"),strDefalutValue);
m_Slidervalue =strDefaultLongValue; // 目前資料
long lAlphaValue=_ttoi(strDefaultLongValue.GetBuffer());
m_Slider2->SetPos((int)lAlphaValue);

// 設定透明度關鍵片段
long lAlphaValue=(long)nPos;
::SetLayeredWindowAttributes(::g_LongmanMainHelperWindow, 0, (255 * lAlphaValue) / 100, LWA_ALPHA);
// 記憶使用者資料
Update_AnyLongValue(thdDlg->myList,_T("lAlphaValue"),lAlphaValue);


[Bug Report] [已經解決] 視窗不明原因位置改變至 x=-65535 y=-65535

[solved]
// 原因
// 因為視窗縮小時, 會引發 OnMove 事件, 這時候 視窗的位置為 x=-65535 , y=-65535
// 所以存檔時要作處理

code
if(curWindowRect.left<0>
return ;


-------------------------------- old information ------------------------------------------------
Chinese

暫時解決方法: 請用簡陋的 Setup.exe 重新設定資料.

English
The temporary solution is reseting the configuration data by executing the Setup.exe.