How to build a modular app?

This is probably a very amateurish question… but I do I get my app to expose different functionality depending on the installation type ?

I know I can compile different distributions… but I don’t want to be forced to compile 10 versions of my app one for each additional module…

I would like that if some external library is present… then the app would just show the corresponding menus, etc…

I would think there are multiple approaches to take depending on what the end goal of your app actually is.

Are you talking about system libraries and functionality?
Or do you mean more like a plugin system like Xojo?

I guess I am talking about system libraries and functionality… ?

Not exactly sure what the difference is… but to make it simple… I basically want new menus (processing options) to show up depending on the presence of x module…

Well with a simpler local system like plugins it’d be more of if file exists then.
I think for system libraries you’ll have to use declares to find out if they’re available.

My question would be then… ‘If file exists’… then… what ?

I have to embedd anyway all the windows, methods, etc in the main compiled app, and ‘if file is present’ then .enable the menus ?

that’s the approach ?

Yes that seems reasonable to me. I would go the inverse, removing menu items if the file isn’t present.

What about the contents of the module/file to distribute… if everything is already in the main compiled app… what’s the point of distributing a file ? With what content ? Can’t a user simply create a file named MyModule and just enable the disabled modules ?

Yeah that would be a loophole, but you haven’t exactly laid out enough detail for me to make a better recommendation.

Do you mean you build a “main application” and then as people license other “modules” they get other “files” and install them and new features just appear in the menus & windows ?

yes, Norman…

If the files are data files, then the presence of a file name doesnt make the app work… the data itself has to mean something, such as a list of hotel locations.

If the file causes new program functionality to appear, one way to do it might be to do this in EnableMenuItems

if bFileWasPresent then Featuremenuitem.enabled = true else Featuremenuitem.caption = "-" //turns the menu into a separator Featuremenuitem.enabled = false //but add similar checks into the menu handler too end if

bWasFilePresent can either be a boolean that records whether the file was there, OR
it can be set to true if the file exists and contains data that is valid, such as a serial number, some text or a hashed value that only you know.
Simply creating a blank file wouldnt do the trick, even if you knew the name the file should have.

Each “module” needs to contain executable code
Xojo cannot create something like a DLL which contains executable code

So about the only ways I can quickly think of to achieve this is

  1. to make each “module” a separate executable and each can talk to the other via some coordinated / consistent mechanism (like IPC sockets)

  2. make each “module” a set of xojoscripts that can be added (but this will restrict you in certain ways as far as sharing objects etc)

  3. you build the entire thing as one application with all the “modules” in it and turn things on and off via a license key or some other mechanism

It sounds like you have all the parts and pieces already in one main app. The way I do is set a global variable in my app to keep track of the modules that are available.

If a user orders more modules, simply send him a new license code that contains the information needed to unlock the desired modules.

Yes, this is what I had thought/used until now… --> you build the entire thing as one application with all the “modules” in it and turn things on and off via a license key or some other mechanism

The only problem I see with that is that as the project grows bigger Xojo’s IDE becomes slower… it can be painful sometiem to wait a minute for a couple of controls to get duplicated…

But anyway… thanks everybody for the clarification…

container controls are a god send

much of the ide is containers full of containers full of containers

that way you can work on one of the containers instead of one giant window with thousands of controls