COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 08-03-2010, 01:46 AM   #1
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 2,973
Default Auto focus PromptUserInput() on Windows

I have modded IPlug so that on Windows the keyboard focus is automatically set in PromptUserInput() by sending an EM_SETSEL message to select the text, and then I call SetFocus() to set the focus. However, the selection is almost immediately cancelled again by the WM_TIMER > kUpdate routine in IGraphicsWin::WndProc(), which updates the text of the edit box. So I have changed kUpdate to only update the edit box if the text has actually changed, and now the selection remains.

This mod also fixes updating the combo box, which doesn't respond to WM_SETTEXT but needs CB_SELECTSTRING instead.

Open:
wdl/IPlug/IGraphicsWin.cpp

Find:
Code:
							SendMessage(pGraphics->mParamEditWnd, WM_SETTEXT, 0, (LPARAM) txt);
Replace with:
Code:
							char currentText[MAX_PARAM_LEN];
							SendMessage(pGraphics->mParamEditWnd, WM_GETTEXT, MAX_PARAM_LEN, (LPARAM) currentText);
							if (strcmp(txt, currentText))
							{
								if (pGraphics->mEdParam->GetNDisplayTexts())
									SendMessage(pGraphics->mParamEditWnd, CB_SELECTSTRING, -1, (LPARAM) txt);
								else
									SendMessage(pGraphics->mParamEditWnd, WM_SETTEXT, 0, (LPARAM) txt);
							}
Find:
Code:
		mParamEditWnd = CreateWindow("EDIT", currentText, WS_CHILD | WS_VISIBLE | ES_CENTER | ES_MULTILINE,
			cX - w/2, cY - h/2, w, h, mPlugWnd, (HMENU) PARAM_EDIT_ID, mHInstance, 0);
	}
Replace with:
Code:
		mParamEditWnd = CreateWindow("EDIT", currentText, WS_CHILD | WS_VISIBLE | ES_CENTER | ES_MULTILINE,
			cX - w/2, cY - h/2, w, h, mPlugWnd, (HMENU) PARAM_EDIT_ID, mHInstance, 0);
		SendMessage(mParamEditWnd, EM_SETSEL, 0, -1);
	}
	SetFocus(mParamEditWnd);
__________________
Martinic Kee Bass - Scanner Vibrato - Elka Panther - Tale's JSFX Pack
Tale is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:45 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.