Click here to Skip to main content
15,914,016 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: difference between TRUE and true Pin
toxcct11-Sep-06 5:19
toxcct11-Sep-06 5:19 
AnswerRe: difference between TRUE and true Pin
Michael Dunn11-Sep-06 7:34
sitebuilderMichael Dunn11-Sep-06 7:34 
GeneralRe: difference between TRUE and true Pin
Tara1411-Sep-06 8:44
Tara1411-Sep-06 8:44 
GeneralRe: difference between TRUE and true Pin
Nish Nishant11-Sep-06 8:51
sitebuilderNish Nishant11-Sep-06 8:51 
GeneralRe: difference between TRUE and true Pin
Michael Dunn11-Sep-06 8:51
sitebuilderMichael Dunn11-Sep-06 8:51 
GeneralRe: difference between TRUE and true Pin
Zac Howland11-Sep-06 9:08
Zac Howland11-Sep-06 9:08 
GeneralRe: difference between TRUE and true Pin
Tara1411-Sep-06 8:56
Tara1411-Sep-06 8:56 
QuestionCEdit: How do I track non visible edit changes? Pin
Dimitris Vikeloudas11-Sep-06 4:55
Dimitris Vikeloudas11-Sep-06 4:55 
I have a subclass of a CEdit. I want to be able to resize the visible edit control until it reaches a preset bound and then to keep scrolling horizontaly and vertically. I wrote the following code

To create the control

<br />
   dwStyle = ES_LEFT | WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL;<br />
<br />
   if( multiline ) {<br />
     m_pEdit->setMultilineOn();<br />
     dwStyle = dwStyle | ES_AUTOVSCROLL | ES_MULTILINE | ES_WANTRETURN;<br />
   }<br />
         // First set the visible text bounds. Simply store them<br />
         // in member variables.<br />
   m_pEdit->set_bounds(maxWidth, maxHeight);<br />
<br />
         // Now create the edit control window<br />
   m_pEdit->Create(dwStyle, rect, this, ID_inline_edit);<br />
<br />
         // Adjust the edit control window<br />
   m_pEdit->SetWindowText(text.data());<br />


The message mapping of my CEdit is
<br />
BEGIN_MESSAGE_MAP(U_W_Edit, CEdit)<br />
  //{{AFX_MSG_MAP(U_W_Edit)<br />
  ON_WM_CTLCOLOR_REFLECT()<br />
  ON_CONTROL_REFLECT(EN_UPDATE, OnEditUpdate)<br />
  ON_NOTIFY_REFLECT(EN_UPDATE, OnEditUpdate)<br />
  ON_WM_KEYUP()<br />
  ON_WM_SIZE()<br />
  ON_WM_CHAR()<br />
  //}}AFX_MSG_MAP<br />
END_MESSAGE_MAP()<br />


My resize code is simple

<br />
afx_msg void<br />
U_W_Edit::OnEditUpdate()<br />
{<br />
<br />
    // Probably called before the window is created.<br />
  if( !::IsWindow(this->m_hWnd) )<br />
    return;<br />
<br />
    // Nothing to do. Internal flag to check for maximum sizes<br />
  if( m_bMaxSizeReached )<br />
    return;<br />
<br />
  int length = this->GetWindowTextLength() + 1;<br />
<br />
  AB_TextBuffer text(length);<br />
<br />
  GetWindowText(text.data(), length);<br />
<br />
  AB_Integer width;<br />
  AB_Integer height;<br />
<br />
  this->get_text_extend((AB_Text) text, width, height);<br />
<br />
  BOOL resize = FALSE;<br />
<br />
  if( width.to_long() > m_width && width <= m_maxWidth ) {<br />
    resize  = TRUE;<br />
    m_width = width.to_long();<br />
  }<br />
<br />
  if( height.to_long() > m_height && height <= m_maxHeight ) {<br />
    resize   = TRUE;<br />
    m_height = height.to_long();<br />
  }<br />
<br />
  if( resize )<br />
    this->SetWindowPos( NULL, 0, 0, m_width, m_height,<br />
                        SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOZORDER );<br />
}<br />


However, any time that I type a new character it scrolls it horizontally or vertically. It never resizes the control until it reaches the maximum sizes.

I used Spy++ and realised that the EN_UPDATE message never reaches my CEdit subclass. I wonder how can I know that the stored text has changed. I tried doing it within the OnChar but it is a nightmare to filter out all characters like arrow keys etc and add in the existing text the new key. Is any simple way to track that the stored text has changed?



Making things simple is an art...
AnswerRe: CEdit: How do I track non visible edit changes? Pin
KellyR11-Sep-06 8:43
KellyR11-Sep-06 8:43 
GeneralRe: CEdit: How do I track non visible edit changes? Pin
Dimitris Vikeloudas11-Sep-06 22:47
Dimitris Vikeloudas11-Sep-06 22:47 
Questionvc++ static library with largeaddressware option Pin
imadkk111-Sep-06 4:46
imadkk111-Sep-06 4:46 
QuestionWindows services shutdown Pin
majco33311-Sep-06 4:37
majco33311-Sep-06 4:37 
AnswerRe: Windows services shutdown Pin
Jun Du11-Sep-06 4:58
Jun Du11-Sep-06 4:58 
QuestionPorting New Changes to a Different PC Pin
Reagan Conservative11-Sep-06 4:32
Reagan Conservative11-Sep-06 4:32 
QuestionCTreeCtrl with checkboxes Pin
eusto11-Sep-06 4:18
eusto11-Sep-06 4:18 
AnswerRe: CTreeCtrl with checkboxes Pin
Hamid_RT12-Sep-06 8:34
Hamid_RT12-Sep-06 8:34 
QuestionCMenu Ownerdraw popup arrow icon Pin
YaronNir11-Sep-06 3:06
YaronNir11-Sep-06 3:06 
Questionwhat is the different of HWND and HDC? Pin
bloodwinner11-Sep-06 2:43
bloodwinner11-Sep-06 2:43 
AnswerRe: what is the different of HWND and HDC? Pin
Maximilien11-Sep-06 2:44
Maximilien11-Sep-06 2:44 
GeneralRe: what is the different of HWND and HDC? Pin
bloodwinner11-Sep-06 2:46
bloodwinner11-Sep-06 2:46 
GeneralRe: what is the different of HWND and HDC? Pin
Rinu_Raj11-Sep-06 3:04
Rinu_Raj11-Sep-06 3:04 
GeneralRe: what is the different of HWND and HDC? Pin
David Crow11-Sep-06 3:07
David Crow11-Sep-06 3:07 
QuestionNeed help: fatal error C1853: 'Debug/kui.pch' is not a precompiled header file created with this compiler Pin
bloodwinner11-Sep-06 1:54
bloodwinner11-Sep-06 1:54 
AnswerRe: Need help: fatal error C1853: 'Debug/kui.pch' is not a precompiled header file created with this compiler Pin
Hamid_RT11-Sep-06 2:03
Hamid_RT11-Sep-06 2:03 
AnswerRe: Need help: fatal error C1853: 'Debug/kui.pch' is not a precompiled header file created with this compiler Pin
toxcct11-Sep-06 2:25
toxcct11-Sep-06 2:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.