Recent

Author Topic: recent files components  (Read 2450 times)

apeoperaio

  • Sr. Member
  • ****
  • Posts: 293
recent files components
« on: February 08, 2018, 11:23:53 am »
I am looking for source implementing recent files feature.
I tried THistoryFiles for lazarus but it does not work properly on osx (see topic: https://forum.lazarus.freepascal.org/index.php/topic,39992.0.html)

Any suggestion?

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: recent files components
« Reply #1 on: February 08, 2018, 11:41:49 am »
you should search for an MRU component/control there is one in the lazarus\components\ directory, and a couple more for delphi floating around some of the work with lcl too. But are you sure is a problem with the component and not the menus in OSx?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

apeoperaio

  • Sr. Member
  • ****
  • Posts: 293
Re: recent files components
« Reply #2 on: February 08, 2018, 01:53:57 pm »
I am looking at mru component in lazarus.
I didn't know about its existence.
Regarding THistoryFiles I got problem with it only on OSX.

Thanks a lot!

apeoperaio

  • Sr. Member
  • ****
  • Posts: 293
[SOLVED] Re: recent files components
« Reply #3 on: March 06, 2018, 10:48:41 am »
I am actually using a modified version of lazarus mru component.
Since I want to add a "clear menu" item I slightly modified mrumanager.
IN ShowRecentFiles I removed:
FMIRecent.clear;
and replaced with
    for I:=FMIRecent.Count - 1 downto 0 do
      if (FMIRecent.Items) is TRecentMenuItem then
        FMIRecent.Delete(I);
In order to delete only items typed as TRecentMenuItem  and not any menu item.
And I replaced:

FMIRecent.Add(M);
with
FMIRecent.Insert(I, M);

In order to let the clear menu item as the last item.
Thanks for the hints.

 

TinyPortal © 2005-2018