Recent

Author Topic: Conditionally include components in a package  (Read 2892 times)

jdlinke

  • Jr. Member
  • **
  • Posts: 62
  • Just old me
Conditionally include components in a package
« on: July 31, 2014, 06:02:20 am »
I'm in the beginning stages of developing a set of three components. Two of them are dependent upon other packages that an end-user programmer may or may not have installed (richmemopackage and SynEdit).

Is there a way to determine whether a particular package has been installed, and to create conditional statements based upon whether this is true or false? Then I can simply not include/register the individual components that wouldn't work if the dependency isn't first installed.

This seems like an easy task, but I haven't been able to find info on how to accomplish it.

Thanks for any help y'all can provide.
Lazarus 1.2.4 32-bit version on Windows 8.1 64-bit, Windows 7 64-bit, and Windows XP 32-bit

Currently developing TimberLog and the VirtualDBScroll Component Package

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Conditionally include components in a package
« Reply #1 on: July 31, 2014, 04:16:00 pm »
Is there a way to determine whether a particular package has been installed, and to create conditional statements based upon whether this is true or false? Then I can simply not include/register the individual components that wouldn't work if the dependency isn't first installed.
No. Create more than one package instead. Make it like this:
if:
A: the independent package
B: the package that depends on C
C: the dependant package
then
B depends on A and C

So, even if C is not installed, people can still install A without installing B.

jdlinke

  • Jr. Member
  • **
  • Posts: 62
  • Just old me
Re: Conditionally include components in a package
« Reply #2 on: July 31, 2014, 04:32:01 pm »
Thanks for the reply. I was hoping there was a way to just automate the whole process so it was all one step and transparent, but this'll be fine.

Just need to split my package up now.
Lazarus 1.2.4 32-bit version on Windows 8.1 64-bit, Windows 7 64-bit, and Windows XP 32-bit

Currently developing TimberLog and the VirtualDBScroll Component Package

 

TinyPortal © 2005-2018