Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Yet two bugs in ElPack

Hi,

1. ELMouseHint.pas:

I already reported it about three months ago, but the bug is still in place, as I've found after updating to 2015.3. The hint is appended by extra CRLF, which causes its incorrect height. The bugfix is sent to lmdsupport. Hope it will be fixed.

2. LMDVistaDialogs.pas:

This is just a brilliant coding :))

      FDialog.SetFileTypeIndex(FFileTypeIndex);

      if FFileTypes.Count > 0 then
      begin
        FFileTypes.AllocNativeBuffer;
        try
          FDialog.SetFileTypes(FFileTypes.Count, FFileTypes.FillNativeBuffer);
        finally
          FFileTypes.FreeNativeBuffer;
        end;
      end;

Did you expect such "SetFileTypeIndex()" will work? Did you ever test your code?

Of course, it should be:

      if FFileTypes.Count > 0 then
      begin
        FFileTypes.AllocNativeBuffer;
        try
          FDialog.SetFileTypes(FFileTypes.Count, FFileTypes.FillNativeBuffer);
          //<abb2015>
          FDialog.SetFileTypeIndex(FFileTypeIndex + 1);
          //</abb2015>
        finally
          FFileTypes.FreeNativeBuffer;
        end;
      end;

First, SetFileTypeIndex must go after  SetFileTypes() and
Second, as in vast majority of OLE controls, indexing starts from one, not from zero.

And here is another piece of code:

function TLMDFileDialogEvents.OnTypeChange(const pfd: IFileDialog): HRESULT;
//<abb2015>
var
  idx : UINT;
//<abb2015>
begin
  //<abb2015>
  pfd.GetFileTypeIndex(idx);
  FDialog.FFileTypeIndex := idx - 1;
  //</abb2015>
  if Assigned(FDialog.FOnTypeChange) then
............................

Otherwise the chosen FileTypeIndex is never returned from the dialog.

Patches are sent to lmdsupport.

Also it would be just nice, if you'll consider to do something with this:

          SD1.FileName := ExtractFileName(CurrentSchemaFile);
          SD1.Dialog.SetFileName(TLMDWideString(SD1.FileName));

and this:

          SD1.DefaultFolder := ExtractFileDir(CurrentSchemaFile);
          if Succeeded(SHCreateItemFromParsingName(PLMDChar(SD1.DefaultFolder), nil, CLSID_IShellItem, LShellItem)) then
            SD1.Dialog.SetFolder(LShellItem);

I have in mind to include the second of lines into the first of them in each case. Otherwise the properties don't work in the dialog events like OnTypeChange. But they should.

Bye!

Comments

Sign In or Register to comment.