Accessing new attributes / properties when creating Inno-Setup from source?

I have a little problem installing Inno Setup from source. I want to change the type of TNewButton to add a bit of functionality to the settings buttons. For example, I changed the type declaration from

TNewButton = class(TButton) protected procedure CreateParams(var Params: TCreateParams); override; end; 

to

 TNewButton = class(TButton) procedure CMDialogChar( var Msg: TCMDialogChar); message cm_DialogChar; private FNoShortcut : Boolean; protected procedure CreateParams(var Params: TCreateParams); override; public property NoShortcut : Boolean read FNoShortcut write FNoShortcut; end; 

So, I created a private NoShort attribute, accessed through the public NoShortcut property and used in the CMDialogChar procedure (I want to disable in a specific situation that the ca buttons are activated using shortcuts). There are some other things that I want to implement, but they lead to the same problem:

I can compile Inno Setup with these changes without any problems (I use Delphi 2009 to get Unicode support), and I can also create an installer. But when I try to access the new NoShortcut property in the .iss file (for example, "WizardForm.NextButton.NoShortcut: = true;"), the Inno compiler stops with an error

 Unknown Identifier 'NOSHORTCUT' 

Do I have to register these new attributes and properties in a special way to use them in my file files? Any help would be appreciated: D

+4
source share
1 answer

As TLama noted, the new identifier must be registered in both ScriptClasses_C.pas and ScriptClasses_R.pas . To be more specific in matters of the question:

In ScriptClasses_C.pas I created the RegisterTNewButton_C procedure so that the compiler ScriptClasses_C.pas out about my new identifier for the button:

 procedure RegisterTNewButton_C(Cl: TPSPascalCompiler); begin with Cl.AddClassN(Cl.FindClass('TButton'), 'TNewButton') do begin RegisterProperty('NoShortcut', 'Boolean', iptrw); end; end; 

In ScriptClasses_R.pas I basically do the same thing, but I additionally had to implement for getter and setter for the new identifier:

 procedure TNewButtonNoShortcut_R(Self: TNewButton; var T: Boolean); begin T := Self.NoShortcut; end; procedure TNewButtonNoShortcut_W(Self: TNewButton; const T: Boolean); begin Self.NoShortcut := T; end; procedure RegisterTNewButton_R(CL: TPSRuntimeClassImporter); begin with CL.Add(TNewButton) do begin RegisterPropertyHelper(@TNewButtonNoShortcut_R,@TNewButtonNoShortcut_W,'NoShortcut'); end; end; 

To do this, finally, the operation of RegisterTNewButton_C must be called in the ScriptClassesLibraryRegister_C and RegisterTNewButton_R ScriptClassesLibraryRegister_R in ScriptClassesLibraryRegister_R respectively.

In addition, I deleted / commented out the lines that TNewButton previously registered (in RegisterBidiCtrls_C and RegisterBidiCtrls_R ) to avoid errors that might occur when a component is registered twice. But I do not know if this is necessary.

+4
source

Source: https://habr.com/ru/post/1496567/


All Articles