Skip to main content

Featured

Build docker image from multiple build contexts

Build docker image from multiple build contexts Building a docker image requires specifying a source of truth to include in the image from a local directory or a remote git repository. In the previous version, the docker BuildKit allows users to specify the build context from a single source of truth only. However, the engineers may need to have the context from different locations based on the type of files. For instance, icons, images or other resources that are not included in the same package, including the resource from other docker images. Fortunately, the Docker Buildx toolkit supports multiple build context flag for Docker 1.4. Let's learn how to use this new feature. The following list is a shortcut for jumping into a specific topic handy. What version of Docker is this tutorial targeting? How to specify the version of Dockerfile frontend? Ho

[CDialog]顯示不固定字串於Dialog上物件的ToolTip

Reference: Handling TTN_NEEDTEXT Notification for Tool Tips

這邊所要處理的是取得到TTN_NEEDTEXT,之後再根據得到的資料,塞給ToolTip來顯示。
建立步驟如下:

1.先在MessageMap()加入ON_NOTIFY()。這邊ID設為0,則為Dialog會收到訊息。
 BEGIN_MESSAGE_MAP(CTestDlg, CDialog)  
     //Show Tips  
     ON_NOTIFY_EX(TTN_NEEDTEXT, 0, &CTestDlg::OnToolTipText)        // the ID of a tool tip is always 0.  
 END_MESSAGE_MAP()  

2.新增OnToolTipText()。由於TOOLTIPTEXT結構用來顯示Tip的szText長度限制為80,所以這邊就要將需要顯示文字的位置指給lpszText。這樣做就沒有顯示長度的限制了。
之後僅需將需要跳出tip的物件的ID加到此Function處理就好。

header
 ....  
 afx_msg BOOL OnToolTipText(UINT ID, NMHDR *pNMHDR, LRESULT *pResult);  
 ....  

cpp
 BOOL CDSEnvItemEdtDlg::OnToolTipText(UINT ID, NMHDR *pNMHDR, LRESULT *pResult)  
 {  
     BOOL IsOK = FALSE;  
     TOOLTIPTEXT *pToolTipText = (TOOLTIPTEXT*) pNMHDR;  
     UINT nID = (UINT)pNMHDR->idFrom;                    //得到相對應的Dialog的ID,有可能是HWND。  
     if ( !(pToolTipText->uFlags & TTF_IDISHWND) ) {        //確認是否為HWND  
         return FALSE; };  
   
     nID = (UINT)::GetDlgCtrlID((HWND)nID);                //取得目前停留的子空見ID。  
   
     switch (nID)  
     {  
         case IDC_EDT_TEXT:  
             pToolTipText->lpszText = this->m_edtPicFilePath.GetBuffer();  
             this->m_edtPicFilePath.ReleaseBuffer();  
             IsOK = TRUE;  
             break;  
         default:  
             break;  
     }    //End of switch (nID)  
   
     return IsOK;  
 }  

Comments

Popular Posts