#### Archived

This topic is now archived and is closed to further replies.

# Problem with a textbox in win32

This topic is 6233 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
I''m not sure it will solve your problem but you could try to call Update(hWnd).

##### Share on other sites
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

1. 1
Rutin
28
2. 2
3. 3
4. 4
5. 5

• 11
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632952
• Total Posts
3009438
• ### Who's Online (See full list)

There are no registered users currently online

×