2

I have a few install scripts, with almost the same functionality. I separated same functions to include file with common code, but from time to time I need to override some of those.

Unfortunately, override at the end as in Delphi doesn't help:

function NextButtonClick(CurPageID: Integer): Boolean; override;
TLama
  • 75,147
  • 17
  • 214
  • 392
mishander
  • 139
  • 9
  • @RobeN, the question is perfectly understandable. IMHO, questions like these deserve upvote (not because they show research effort, but because they are useful), not those like [`this one`](http://stackoverflow.com/q/23519174/960757), where the OP spent absolutely no time to find a solution by themselves (that question is even a duplicate). It might have been helpful (if there was a way for overriding) even for you when you're using a common code base where certain event methods are utilized. – TLama May 08 '14 at 09:55
  • FWIW, "override" represents a completely different concept that wouldn't have worked the way you wanted it to anyway. (No classes.) – Miral May 09 '14 at 09:02
  • @Miral, e.g. `NextButtonClick` is actually a method! Though I don't know the `Self` object since it is not accessible (I guess the script runner itself), it is a method. – TLama May 09 '14 at 09:34
  • Yeah, but to be able to override it you need to have it in a subclass. And you can't declare one of those in the script. – Miral May 11 '14 at 00:28

2 Answers2

2

That is not possible. One thing is that e.g. the NextButtonClick which you mentioned is meant to be the event method whose you do not override; the other is that Inno Setup Pascal Script doesn't support method overriding as such.

The only reliable workaround I can think of is to RY (from DRY), by separating event methods from your common code.

TLama
  • 75,147
  • 17
  • 214
  • 392
  • Tnx a lot, @TLama. Sad that pascalscript is so poor though. I spent some time looking for any possible solution, and after I found nothing that question was kind of desperate move :) – mishander May 08 '14 at 10:54
1

Have a look at the ISD specification, which is a suggested method of laying out custom wizard page code in a highly modular and reusable fashion.

It's not generally applicable to all event functions, but it might help you with NextButtonClick and other related page events, at least.

(I actually have some code that helps out with merging other event functions somewhat, but it's not really ready for public use yet.)

Miral
  • 12,637
  • 4
  • 53
  • 93