Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Sizable control in toobar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Sizable control in toobar

 Post Reply Post Reply
Author
Message
Kenneth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 May 2004
Location: United States
Status: Offline
Points: 256
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kenneth Quote  Post ReplyReply Direct Link To This Post Topic: Sizable control in toobar
    Posted: 28 June 2007 at 3:35pm
Is it possible to place a control such as the CXTPControlEdit in a toolbar and make the horizontal size of that control dependent upon the width of the window containing the control?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 29 June 2007 at 1:09am
Hello,
 
Set xtpFlagControlStretched flag to control.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Kenneth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 May 2004
Location: United States
Status: Offline
Points: 256
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kenneth Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2007 at 1:05pm

Ok, that works.  I placed a CComboBoxEx control in a commandbar with:

CXTPControlCustom* pControl;
 if(lpCreateControl->nID == ID_INPUTDATA)
      {
      if(!m_Combo.Create(CBS_DROPDOWN|WS_CHILD,CRect(0,0,126,200),parent,ID_INPUTDATA))
           return(FALSE);
      pControl = CXTPControlCustom::CreateControlCustom(&m_Combo);
      pControl->SetFlags(xtpFlagManualUpdate);
      pControl->SetFlags(pControl->GetFlags() | xtpFlagControlStretched);
      lpCreateControl->pControl = pControl;
      return(TRUE);
      }
 
Now I want to be able to detect when the enter key has been pressed  in the combobox edit window.  How is this done?
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 30 June 2007 at 4:05am

Hello,

I recommend you use xtpControlComboBox instead of xtpControlCustom + CComboBoxEx. it supports themes and easy to catch messages etc.
See our CustomThemes sample.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Kenneth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 May 2004
Location: United States
Status: Offline
Points: 256
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kenneth Quote  Post ReplyReply Direct Link To This Post Posted: 01 July 2007 at 1:03pm

To our dismay, many of our paying customers insist on using Windows 98 and ME.  That means we have to support unicows and unicode on those systems.  The xtpControlComboBox does not support the code necessay to work in this environment.

Is there any way at all to catch the enter key in a CComboBoxEx edit window and divert to mainfrm for processing when the CComboBoxEx control has been inserted into a command bar as indicated?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 02 July 2007 at 4:56am

Hi,

Just override CXTComboBoxEx:
 
class CAddressComboBox : public CXTComboBoxEx
{
 BOOL PreTranslateMessage(MSG* pMsg);
};
 
 
BOOL CAddressComboBox::PreTranslateMessage(MSG* pMsg)
{
 if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
 {
  GetOwner()->SendMessage(WM_COMMAND, IDOK);
 }
 return CXTComboBoxEx::PreTranslateMessage(pMsg);
}
 
btw what methods/messages are not supported by xtpControlComboBox + Unicows?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Kenneth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 May 2004
Location: United States
Status: Offline
Points: 256
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kenneth Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2007 at 9:17am
Oleg
 
If I understand it correctly, we have to be able to do a SendMessage to CComboBoxEx in order to get/set the Unicode text.  The SendMessage is of type EM_SETTEXTEX and EM_GETTEXTEX with respective SETTEXTEX and GETTEXTEX codepage parameter set to a unicode codepage (1200).
 
In additon, the standard CComboBoxEx edit window is replaced with a CRichEditCtrl in order for proper operation on Windows 98/ME.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 02 July 2007 at 10:32am
Hi,
 
CXTPEdit that used by CXTPControlComboxBox is also RichEdit and it also use EM_GETTEXTEX to get text (Always 1200 used) ... so guess it can work with unicows.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Kenneth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 May 2004
Location: United States
Status: Offline
Points: 256
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kenneth Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2007 at 12:43pm
I have a test setup using CXTPControlComboBox and it does not display unicode correctly on Windows 98/ME.  When I add some test data to the CXTPControlComboBox list containing 등기우편.com, it works ok on XP but on Windows ME it displays as ????.com.  If I use our CComboBoxEx it works ok on both XP and Windows 98/ME.  Note that in both cases I have enabled unicows support on Windows 98/ME.
 
The only difference is with CXTPControlComboBox I have to insert items into the list with AddString() whereas with CComboBoxEX I use the InsertItem() (which is not supported by CXTPControlComboBox as far as I can tell).  Any ideas?
 
BTW, the GetOwner() in your comments above does return the correct parent window.  I used AfxGetMainWnd() instead and it works.
Back to Top
Kenneth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 May 2004
Location: United States
Status: Offline
Points: 256
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kenneth Quote  Post ReplyReply Direct Link To This Post Posted: 03 July 2007 at 1:36pm
Oleg
 
I am a bit confused about the CXTPControlComboBox.  In the standard Microsoft CComboBoxEx control, the display of Unicode on Windows 98/ME using unicows requires the replacement of the standard edit window with one based on richedit.  The list box has no problem with the unicode characters.
 
Why does the CXTPControlCombobox list box have this problem?  As you stated, the edit control does support unicode/unicows (although there is some type of font height issue). 
 
Also, does the CXTPControlComboBox support images like the CComboBoxEx?
 
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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 July 2007 at 2:16pm

Hello,

CXTPControlCombobox  uses RchEdit for edit, but standard system ListBox for List, CComboBoxEx don't use system drawing, but manually draw text/icons for items. Think we will change it too + will add icons support.
 
I can't test it now with all my Win98/ME - they don't have Japanese, Korean or Chinese languages installed.
 
ps. You can manully add self drawn list box now that will support unicode - see CustomThemes sample.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Kenneth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 May 2004
Location: United States
Status: Offline
Points: 256
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kenneth Quote  Post ReplyReply Direct Link To This Post Posted: 04 July 2007 at 2:17pm
Oleg
 
When you add the icons/owner draw to CXTPControlComboBox, let me know and I can test it.  We do have Windowns Me with Chinese support.
Back to Top
Kenneth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 May 2004
Location: United States
Status: Offline
Points: 256
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kenneth Quote  Post ReplyReply Direct Link To This Post Posted: 02 August 2007 at 6:44pm

CXTPEdit does use EM_GETTEXTEX to get text if _UNICODE is set however it does not use EM_SETTEXEX to set text, and it appears that I cannot get access to the richedit control to set it myself.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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 August 2007 at 3:36am
Hello,
 
Call GetEditCtrl() to get pointer to richedit.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Kenneth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 May 2004
Location: United States
Status: Offline
Points: 256
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kenneth Quote  Post ReplyReply Direct Link To This Post Posted: 03 August 2007 at 2:52pm

It appears that the CXTPControlCombobox listbox is not unicode/unicows compliant.  If I add unicode text to it using AddString, then in the DrawItem function (taken from the CustomThemes example), the following returns a CString that appears to have gone through some type of codepage conversion on Windows 98 as indicated by ??? in the text when drawn using the dc.TextOut function.

 ((CListBox*)this)->GetText(lpDrawItemStruct->itemID,strText);
 
Any ideas?
 
 
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.172 seconds.