tvplanit: Fix wavdlg to play the selected sound file.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4739 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-13 13:04:44 +00:00
parent 7ae8dc2155
commit d1a1583328
3 changed files with 13 additions and 8 deletions

View File

@ -667,8 +667,8 @@ begin
try try
SoundFinder.DingPath := AlarmWavPath; SoundFinder.DingPath := AlarmWavPath;
SoundFinder.Populate; SoundFinder.Populate;
SoundFinder.ShowModal;
SoundFinder.OnPlaySound := DoPlaySound; SoundFinder.OnPlaySound := DoPlaySound;
SoundFinder.ShowModal;
if SoundFinder.ReturnCode = TvpEditorReturnCode(rtCommit) then begin if SoundFinder.ReturnCode = TvpEditorReturnCode(rtCommit) then begin
if SoundFinder.CBDefault.Checked then if SoundFinder.CBDefault.Checked then
AlarmWavPath := '' AlarmWavPath := ''

View File

@ -36,7 +36,7 @@ object FrmSoundDialog: TFrmSoundDialog
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 446 ClientHeight = 446
ClientWidth = 275 ClientWidth = 275
TabOrder = 0 TabOrder = 2
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 34 Height = 34
@ -66,7 +66,7 @@ object FrmSoundDialog: TFrmSoundDialog
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 38 ClientHeight = 38
ClientWidth = 275 ClientWidth = 275
TabOrder = 1 TabOrder = 2
object PlayButton: TSpeedButton object PlayButton: TSpeedButton
Left = 8 Left = 8
Height = 25 Height = 25
@ -126,7 +126,7 @@ object FrmSoundDialog: TFrmSoundDialog
ItemHeight = 0 ItemHeight = 0
Mask = '*.wav' Mask = '*.wav'
OnChange = FileListBox1Change OnChange = FileListBox1Change
TabOrder = 2 TabOrder = 1
end end
end end
object Splitter1: TSplitter object Splitter1: TSplitter
@ -147,7 +147,8 @@ object FrmSoundDialog: TFrmSoundDialog
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
FileSortType = fstNone FileSortType = fstNone
TabOrder = 2 TabOrder = 0
OnChange = ShellTreeViewChange
ObjectTypes = [otFolders] ObjectTypes = [otFolders]
end end
end end

View File

@ -70,6 +70,7 @@ type
procedure CancelBtnClick(Sender: TObject); procedure CancelBtnClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState); Shift: TShiftState);
procedure ShellTreeViewChange(Sender: TObject; Node: TTreeNode);
private private
FOnPlaySound: TVpPlaySoundEvent; FOnPlaySound: TVpPlaySoundEvent;
public public
@ -129,16 +130,19 @@ begin
end else begin end else begin
Drive := UpCase(ExtractFileDrive(DingPath)[1]); Drive := UpCase(ExtractFileDrive(DingPath)[1]);
if FileExists(DingPath) and (Drive in ['A'..'Z']) then begin if FileExists(DingPath) and (Drive in ['A'..'Z']) then begin
// DriveComboBox1.Drive := Drive;
// DirectoryListBox1.Directory := ExtractFileDir(DingPath);
ShellTreeview.Path := ExtractFileDir(DingPath); ShellTreeview.Path := ExtractFileDir(DingPath);
FileListBox1.FileName := DingPath; FileListBox1.FileName := DingPath;
end else begin end else begin
// DirectoryListBox1.Directory := ExtractFileDir(ParamStr(0));
ShellTreeView.Path := ExtractFileDir(ParamStr(0)); ShellTreeView.Path := ExtractFileDir(ParamStr(0));
end; end;
end; end;
end; end;
procedure TFrmSoundDialog.ShellTreeViewChange(Sender: TObject; Node: TTreeNode);
begin
FileListbox1.Directory := ShellTreeView.Path;
end;
{=====} {=====}
procedure TFrmSoundDialog.CBDefaultClick(Sender: TObject); procedure TFrmSoundDialog.CBDefaultClick(Sender: TObject);