Problem with a textbox in win32

Started by
1 comment, last by Zeblar Nagrim 22 years, 6 months ago
I have a little problem with texboxes in win32... PROBLEM: Want to display the current row (of the textbox) in the statusbar when the user click somewhere in the textbox. SOLUTION: When the I get a WM_COMMAND, I check if the ID is my textbox...
  

case WM_COMMAND:

  ....
  
  switch(LOWORD(wParam))
  {
    case ID_TEXTBOX:
    {
      ....
    }
    break;		
  } 

  ....

  
... then I get the current line (where the carret is) and send a SB_SETTEXT to the status bar.
  

WORD End;
				
SendMessage(GetDlgItem(hwnd, ID_TEXTBOX), EM_GETSEL, (WPARAM)
  (LPDWORD) &m_sFindPos,(LPARAM) (LPDWORD) &End);

WORD Row = SendMessage(GetDlgItem(hwnd, ID_TEXTBOX),            EM_LINEFROMCHAR, m_sFindPos, 0);

char itoabuff[20];
SendMessage(GetDlgItem(hwnd, ID_STATUSBAR), SB_SETTEXT, 0, (LPARAM) itoa(Row, itoabuff, 10));

  
The problem is that the text does not appear in the statusbar until the textbox have losed the focus. But I want to show the information immediatly! Arrgggg.... If I call SetFocus(g_hwndMain) after the call to SB_SETTEXT, the text show up immediatly in the status bar, but then the textbox never get focus and I can´t copy text with CTRL+C etc. Please help me! (sorry for my poor english!) Zeblar Nagrim, Lord of Chaos
Advertisement
I''m not sure it will solve your problem but you could try to call Update(hWnd).
UpdateWindow() dosn´t work, thanks anyway.

Even if I call SetWindowText() on my main window, nothing shows upp until the Text box has lost focus.

How can I fix this? Maybe I´m responding to the wrong message?



Zeblar Nagrim, Lord of Chaos

This topic is closed to new replies.

Advertisement