Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - SHAutoComplete in CXTPControlCombox
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SHAutoComplete in CXTPControlCombox

 Post Reply Post Reply
Author
Message
blueseaing View Drop Down
Groupie
Groupie


Joined: 14 June 2004
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote blueseaing Quote  Post ReplyReply Direct Link To This Post Topic: SHAutoComplete in CXTPControlCombox
    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; 
  }
}

 

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
blueseaing View Drop Down
Groupie
Groupie


Joined: 14 June 2004
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote blueseaing Quote  Post ReplyReply Direct Link To This Post 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. 

          2004-11-04_030207_CustomThemes.rar



Edited by blueseaing
Back to Top
blueseaing View Drop Down
Groupie
Groupie


Joined: 14 June 2004
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote blueseaing Quote  Post ReplyReply Direct Link To This Post Posted: 05 November 2004 at 12:39am

wait for oleg help. thanks.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.