/// IME変換時のイベントハンドラ
/// </summary>
/// <param name="type"></param>
- public delegate void ImeCompositionEventHandler(string text);
+ public delegate void ImeCompositionEventHandler(int type, string text);
public event ImeCompositionEventHandler ImeComposition;
private bool complemented = false;
switch (m.Msg)
{
case 0x010F: //WM_IME_COMPOSITION
- if (((int)m.LParam & GCS_COMPSTR) == GCS_COMPSTR)
- {
+ //if (((int)m.LParam & GCS_COMPSTR) == GCS_COMPSTR)
+ //{
IntPtr hIMC = ImmGetContext(this.Handle);
StringBuilder sb = new StringBuilder(1024);
byte[] buffer = new byte[1024];
ImmReleaseContext(this.Handle, hIMC);
string str = Encoding.GetEncoding("Shift_JIS").GetString(buffer);
str = str.TrimEnd('\0');
- this.ImeComposition(str);
- }
+ this.ImeComposition((int)m.LParam, str);
+ //}
break;
}
base.WndProc(ref m);
this.label.Visible = String.IsNullOrEmpty(this.textBox.Text);
}
- private void textBox_ImeComposition(string text)
+ private void textBox_ImeComposition(int type, string text)
{
- this.label.Visible = String.IsNullOrEmpty(text);
+ this.label.Visible = String.IsNullOrEmpty(this.textBox.Text) && String.IsNullOrEmpty(text);
}
}
}
{
if (Program.SettingForm == null)
return;
- if (this.textBox_command.Text.Length == 0)
+
+ if (String.IsNullOrEmpty(this.textBox_command.Text))
{
this.label_duplicate.Visible = false;
this.button_ok.Enabled = false;
private void textBox_name_TextChanged(object sender, EventArgs e)
{
+ if (String.IsNullOrEmpty(this.textBox_name.Text))
+ return;
+
if (this.textBox_name.Text[0] == '@')
{
this.label_engine_duplicate.Text = "※先頭に@は使用できません";
}
this.searchTextBox.TextBox.SetDropdownFormLocation();
- //this.searchTextBox.TextBox.DropdownForm.DropdownListBox.SelectedIndex = 0;
this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(true);
- //this.searchTextBox.TextBox.DropdownForm.DropdownListBox.SelectedIndex = -1;
+ }
+ else
+ {
+ this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
}
}
break;
//this.ShowFileList();
}
- private void textBox_cmd_ImeComposition(string text)
+ private void textBox_cmd_ImeComposition(int type, string text)
{
- Debug.WriteLine("ImeComposition:" + suggestString + "," + text);
- if (String.IsNullOrEmpty(text)){
+ if(!String.IsNullOrEmpty(this.searchTextBox.TextBox.Text))
+ {
+ string str = this.searchTextBox.TextBox.Text;
+ text = str.Substring(0, this.searchTextBox.TextBox.SelectionStart)
+ + text
+ + str.Substring(this.searchTextBox.TextBox.SelectionStart);
+ }
+
+ Debug.WriteLine("str:" + text);
+
+ Debug.WriteLine("ImeComposition:(" + type + ") " + suggestString + "," + text);
+ if (String.IsNullOrEmpty(text))
+ {
this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
this.suggestString = "";
}
else
- this.SetEngineDropdownList(text);
+ {
+ if((type & Win32.GCS_RESULTSTR) != Win32.GCS_RESULTSTR)
+ this.SetEngineDropdownList(text);
+ }
}
private void dropdownListBox_SelectedIndexChanged(object sender, EventArgs e)
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Newtonsoft.Json.Net20, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>bin\Release\Newtonsoft.Json.Net20.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
+ <Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<FallbackCulture>ja-JP</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
+ <EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
+ </PropertyGroup>
</Project>
\ No newline at end of file
public const int WM_IME_REQUEST = 0x0288;
public const int IMR_QUERYCHARPOSITION = 0x0006;
+ public const int GCS_COMPSTR = 0x0008;
+ public const int GCS_RESULTSTR = 0x0800;
+
[StructLayout(LayoutKind.Sequential)]
public struct KeyboardHookStruct
{