|
@@ -55,6 +55,7 @@ type
|
|
keyDownText: String;
|
|
keyDownText: String;
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
private
|
|
private
|
|
|
|
+ procedure setTextAndSelect( newText:String );
|
|
procedure handleSpecialKeys( var Key: Word );
|
|
procedure handleSpecialKeys( var Key: Word );
|
|
procedure handleUpKey;
|
|
procedure handleUpKey;
|
|
procedure handleDownKey;
|
|
procedure handleDownKey;
|
|
@@ -300,8 +301,7 @@ procedure TKASPathEdit.ListBoxClick(Sender: TObject);
|
|
begin
|
|
begin
|
|
if FListBox.ItemIndex >= 0 then
|
|
if FListBox.ItemIndex >= 0 then
|
|
begin
|
|
begin
|
|
- Text:= FListBox.Items[FListBox.ItemIndex];
|
|
|
|
- SelStart:= UTF8Length(Text);
|
|
|
|
|
|
+ setTextAndSelect( FListBox.Items[FListBox.ItemIndex] );
|
|
HideListBox;
|
|
HideListBox;
|
|
SetFocus;
|
|
SetFocus;
|
|
end;
|
|
end;
|
|
@@ -369,6 +369,19 @@ end;
|
|
|
|
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
+procedure TKASPathEdit.setTextAndSelect( newText:String );
|
|
|
|
+var
|
|
|
|
+ start: Integer;
|
|
|
|
+begin
|
|
|
|
+ if Pos(Text,newText) > 0 then
|
|
|
|
+ start:= UTF8Length(Text)
|
|
|
|
+ else
|
|
|
|
+ start:= UTF8Length(ExtractFilePath(Text));
|
|
|
|
+ Text:= newText;
|
|
|
|
+ SelStart:= start;
|
|
|
|
+ SelLength:= UTF8Length(Text)-SelStart;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TKASPathEdit.DoExit;
|
|
procedure TKASPathEdit.DoExit;
|
|
begin
|
|
begin
|
|
HideListBox;
|
|
HideListBox;
|
|
@@ -450,10 +463,9 @@ begin
|
|
FListBox.ItemIndex:= FListBox.ItemIndex - 1;
|
|
FListBox.ItemIndex:= FListBox.ItemIndex - 1;
|
|
|
|
|
|
if FListBox.ItemIndex >= 0 then
|
|
if FListBox.ItemIndex >= 0 then
|
|
- Text:= FListBox.Items[FListBox.ItemIndex]
|
|
|
|
|
|
+ setTextAndSelect( FListBox.Items[FListBox.ItemIndex] )
|
|
else
|
|
else
|
|
- Text:= ExtractFilePath(Text);
|
|
|
|
- SelStart:= UTF8Length(Text);
|
|
|
|
|
|
+ setTextAndSelect( ExtractFilePath(Text) );
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TKASPathEdit.handleDownKey;
|
|
procedure TKASPathEdit.handleDownKey;
|
|
@@ -466,10 +478,9 @@ begin
|
|
FListBox.ItemIndex:= FListBox.ItemIndex + 1;
|
|
FListBox.ItemIndex:= FListBox.ItemIndex + 1;
|
|
|
|
|
|
if FListBox.ItemIndex >= 0 then
|
|
if FListBox.ItemIndex >= 0 then
|
|
- Text:= FListBox.Items[FListBox.ItemIndex]
|
|
|
|
|
|
+ setTextAndSelect( FListBox.Items[FListBox.ItemIndex] )
|
|
else
|
|
else
|
|
- Text:= ExtractFilePath(Text);
|
|
|
|
- SelStart:= UTF8Length(Text);
|
|
|
|
|
|
+ setTextAndSelect( ExtractFilePath(Text) );
|
|
end;
|
|
end;
|
|
|
|
|
|
{$IF DEFINED(LCLCOCOA)}
|
|
{$IF DEFINED(LCLCOCOA)}
|