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