Print Page | Close Window

SHAutoComplete in CXTPControlCombox

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1363
Printed Date: 06 November 2025 at 11:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SHAutoComplete in CXTPControlCombox
Posted By: blueseaing
Subject: SHAutoComplete in CXTPControlCombox
Date Posted: 02 November 2004 at 11:15pm

Please help me! I use the ::SHAutoComplete in the CMainFrame::OnCreateControl  to a CXTPControlCombox, but it failed ,and the  ::SHAutoComplete  return not S_OK, how can i solve the problem?Does the CXTPControlCombox not support the ::SHAutoComplete?   Thanks a lot.

int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)
{
  if (lpCreateControl->nID == ID_GOTO_BARURL && pToolBar->GetBarID() == IDR_TOOLBAR_ADDR)
  {
     CXTPControlComboBox* pComboUrl = (CXTPControlComboBox*)CControlComboBoxAddress::CreateObject( );
     lpCreateControl->pControl = pComboUrl;

     //use ::SHAutoComplete
     CEdit* pEdit=pComboUrl->GetEditCtrl();
     if(pEdit)  ::SHAutoComplete(pEdit->GetSafeHwnd(),SHACF_DEFAULT);

     return TRUE; 
  }
}

 




Replies:
Posted By: Oleg
Date Posted: 03 November 2004 at 3:49am

after you call CreateObject() edit of Combo Box is NULL, so pEdit == NULL (see debugger).

you need to create custom combo:

 

class CComboBoxURL : public CXTPControlComboBox 
{
 DECLARE_XTP_CONTROL(CComboBoxURL);
public:
 virtual void SetRect(CRect rcControl);
};

IMPLEMENT_XTP_CONTROL(CComboBoxURL, CXTPControlComboBox)

void CComboBoxURL::SetRect(CRect rcControl)
{
 BOOL bCreated = m_pEdit && m_pEdit->GetSafeHwnd();

 CXTPControlComboBox::SetRect(rcControl);

 if (!bCreated && m_pEdit && m_pEdit->GetSafeHwnd())
 {
  ::SHAutoComplete(m_pEdit->GetSafeHwnd(),SHACF _DEFAULT);  

}
}

 

oh.. as i see you already use CControlComboBoxAddress. so add SetRect method.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: blueseaing
Date Posted: 04 November 2004 at 3:02am

Tanks a lot to oleg for your help, and I will trouble you again.

I used your method and the SHAutoComplete will work but I find two problems again , that's 

      1  when I try to drag the autocomplete hook window and the hook window will disappear and only remain the white rectangle ,  the rectanage can zoom ,  after release the mouse ,all disappear.

     2 when the autocomplete list appear the mouse wheel can't use but the common windows

combox can use.

    I change the customtheme example and I post the source code.  and I replace the find combox. Thanks. 

          https://forum.codejock.com/uploads/blueseaing/2004-11-04_030207_CustomThemes.rar - 2004-11-04_030207_CustomThemes.rar



Posted By: blueseaing
Date Posted: 05 November 2004 at 12:39am

wait for oleg help. thanks.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net