• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

ギコナビ


Commit MetaInfo

Révision8c75b563f03558e13718e0ad85442da76b440247 (tree)
l'heure2007-07-22 19:23:51
Auteurh677 <h677>
Commiterh677

Message de Log

追加・適用でカテゴリがクリアされないように修正。
カテゴリが設定されていない場合も登録できないように修正。

Change Summary

Modification

--- a/InputAssist.pas
+++ b/InputAssist.pas
@@ -64,7 +64,8 @@ type
6464 FSortColumn : Integer;
6565 FInsertText : String;
6666 procedure AddListViewItem(ResWord : TResistWord);
67- procedure SetCategory(combo: TComboBox);
67+ procedure SetCategory(combo: TComboBox; selected: String);
68+ function ValidateKey(key, category: String): boolean;
6869 public
6970 { Public éŒ¾ }
7071 procedure SetUpFromEditor();
@@ -143,22 +144,35 @@ procedure TInputAssistForm.AddButtonClick(Sender: TObject);
143144 var
144145 resWord : TResistWord;
145146 begin
146- if (Length(KeyNameEdit.Text) = 0) then begin
147- ShowMessage('ƒL[–¼‚ðÝ’肵‚Ä‚­‚¾‚³‚¢B');
148- end else begin
147+ if (ValidateKey(KeyNameEdit.Text, CategoryNameComboBox.Text)) then begin
149148 if (not InputAssistDM.IsDupulicate(
150149 KeyNameEdit.Text, CategoryNameComboBox.Text) ) then begin
151150 resWord := InputAssistDM.Add(KeyNameEdit.Text);
152151 resWord.SetCategory(CategoryNameComboBox.Text);
153152 resWord.SetText(TextMemo.Text);
154153 AddListViewItem(resWord);
155- SetCategory(CategoryNameComboBox);
154+ SetCategory(CategoryNameComboBox, resWord.GetCategory);
156155 GikoListView1.AlphaSort;
157156 end else begin
158157 ShowMessage('“¯ˆê‚̃L[–¼EƒJƒeƒSƒŠ–¼‚ÅŠù‚É“o˜^Ï‚Ý‚Å‚·B');
159158 end;
160159 end;
161160 end;
161+//! ƒL[–¼EƒJƒeƒSƒŠ—LŒøƒ`ƒFƒbƒN
162+function TInputAssistForm.ValidateKey(key, category: String): boolean;
163+begin
164+ Result := True;
165+ if (Length(key) = 0) then begin
166+ ShowMessage('ƒL[–¼‚ðÝ’肵‚Ä‚­‚¾‚³‚¢B');
167+ Result := False;
168+ end else begin
169+ if (Length(category) = 0) then begin
170+ ShowMessage('ƒJƒeƒSƒŠ‚ðÝ’肵‚Ä‚­‚¾‚³‚¢B');
171+ Result := False;
172+ end;
173+ end;
174+end;
175+
162176 //! íœƒ{ƒ^ƒ“‰Ÿ‰ºŽž‚̃Cƒxƒ“ƒg
163177 procedure TInputAssistForm.DeleteButtonClick(Sender: TObject);
164178 begin
@@ -174,9 +188,7 @@ var
174188 resWord : TResistWord;
175189 begin
176190 if GikoListView1.Selected <> nil then begin
177- if (Length(KeyNameEdit.Text) = 0) then begin
178- ShowMessage('ƒL[–¼‚𖳂µ‚É‚Í‚Å‚«‚Ü‚¹‚ñB');
179- end else begin
191+ if (ValidateKey(KeyNameEdit.Text, CategoryNameComboBox.Text)) then begin
180192 if (not InputAssistDM.IsDupulicate(
181193 KeyNameEdit.Text, CategoryNameComboBox.Text) ) then begin
182194 resWord := TResistWord(GikoListView1.Selected.Data);
@@ -186,7 +198,7 @@ begin
186198 // ˆê——‚̍XV
187199 GikoListView1.Selected.Caption := resWord.GetKey;
188200 GikoListView1.Selected.SubItems[0] := resWord.GetCategory;
189- SetCategory(CategoryNameComboBox);
201+ SetCategory(CategoryNameComboBox, resWord.GetCategory);
190202 GikoListView1.AlphaSort;
191203 end else begin
192204 ShowMessage('“¯ˆê‚̃L[–¼EƒJƒeƒSƒŠ–¼‚ÅŠù‚É“o˜^Ï‚Ý‚Å‚·B');
@@ -297,9 +309,10 @@ begin
297309 LockWindowUpdate(0);
298310 end;
299311 //! ƒJƒeƒSƒŠƒRƒ“ƒ{ƒ{ƒbƒNƒXÝ’è
300-procedure TInputAssistForm.SetCategory(combo: TComboBox);
312+procedure TInputAssistForm.SetCategory(combo: TComboBox; selected: String);
301313 var
302314 cat : TStringList;
315+ i : Integer;
303316 begin
304317 // ŒŸõ—p
305318 cat := TStringList.Create;
@@ -311,6 +324,11 @@ begin
311324 combo.Items.AddStrings(cat);
312325 combo.ItemIndex := 0;
313326 combo.Items.EndUpdate;
327+ // ‘I‘ðÏ‚݂̃JƒeƒSƒŠ‚ɃCƒ“ƒfƒbƒNƒX‚ð•ÏX
328+ i := combo.Items.IndexOf(selected);
329+ if (i <> -1) then begin
330+ combo.ItemIndex := i;
331+ end;
314332 finally
315333 cat.Free;
316334 end;
@@ -326,11 +344,9 @@ begin
326344 FInsertText := '';
327345 CloseAction.ShortCut := TShortCut(0);
328346 // ’ljÁ—pƒL[“ü—ÍOK
329- SetCategory(CategoryNameComboBox);
347+ SetCategory(CategoryNameComboBox, '');
330348 end;
331349 procedure TInputAssistForm.SetUpFromEditor();
332-var
333- cat : TStringList;
334350 begin
335351 Self.Caption := '“ü—̓AƒVƒXƒg';
336352 Panel3.Visible := False;
@@ -340,7 +356,7 @@ begin
340356 FInsertText := '';
341357 CloseAction.ShortCut := ShortCut(VK_ESCAPE, []);
342358 // ŒŸõ—p
343- SetCategory(CategoryComboBox);
359+ SetCategory(CategoryComboBox, '');
344360 end;
345361 function TInputAssistForm.GetInsertText(): String;
346362 begin