Recent

Author Topic: listing resources added to program via project options-resources  (Read 698 times)

muller59

  • New Member
  • *
  • Posts: 16
i add my language translation files as resources to the program.
i can then create the the translation file at runtime from the resource file.
i want to dynamically build the language translation menu from the available resource file contents.

how can i list all resources of type RCDATA in the resource file, so i can "unpack" them one by one and add them to the translation menu.
--
Regards,
Rob.
----------
lubuntu 20.04, Lazarus trunk, FPC 3.0.4
Raspbian Buster, Lazarus trunk, FPC 3.0.4

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: listing resources added to program via project options-resources
« Reply #1 on: August 11, 2020, 04:43:56 pm »
There are quite a lot of classes and functions in the package fcl-res that allow you to deal with resources, starting with the unit resource and the class TResource. Look in fclres.chm for more detailed info (though not much, I fear).

IIRC, there are also some wiki pages about it; a search for "resource" should return (almost) all of them.

HTH!
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

muller59

  • New Member
  • *
  • Posts: 16
Re: listing resources added to program via project options-resources
« Reply #2 on: August 14, 2020, 11:10:36 am »
@lucamar
thanks for your response.
The class you describe deals with lazarus resources.
i found out i am dealing with fpc resources, so that class does not apply.
but the principle  holds true, i will start looking into the fpc side of dealing with resources
--
Regards,
Rob.
----------
lubuntu 20.04, Lazarus trunk, FPC 3.0.4
Raspbian Buster, Lazarus trunk, FPC 3.0.4

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: listing resources added to program via project options-resources
« Reply #3 on: August 14, 2020, 11:41:11 am »
fcl-res is part of FPC, and FPC's resources (modeled after Windows resources).

(Old) Lazarus "resources" are .lrs stuff, which are no real resources at all.

 

TinyPortal © 2005-2018