Advertisement Jump to content


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

Zeblar Nagrim

Problem with a textbox in win32

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

If you intended to correct an error in the post then please contact us.

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 ID_TEXTBOX:


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

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 this post

Link to post
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

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!