Jump to content
  • Advertisement

Archived

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

Zeblar Nagrim

Problem with a textbox in win32

This topic is 6169 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 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 this post


Link to post
Share on other sites
Advertisement
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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!