inno-setuppascalscript

How to place images alongside/underneath radio buttons for Inno Setup InputOptionPage?


I'm using Inno Setup to create an installer for a Quake 3 multiplayer mod. I want to use TInputOptionWizardPage for very generalized graphics settings: "low" and "high".

I'd want to show prospective users (my friends & friends of friends) what "low" and "high" would look like.

Screenshot of installer mock

This question about placing an image on a custom setup page describes how I'd associate the image with the page, but I haven't been able to find a question on here or via search engine that would tell me how I would associate an image with a radio button.

[Code]
// variable declaration, function declarations, asset loading... 

procedure InitializeWizard;
begin 
  // Prior info-gathering TInputQueryWizardPage screen called
  // PlayerBasicsWizardPage...
  
  GraphicsSettingsPage := 
    CreateInputOptionPage(
      PlayerBasicsWizardPage.ID,
      'Graphics',
      'This will show users graphics options',
      'asdf',
      True,
      False);
        
  GraphicsSettingsPage.Add('Low settings');
  GraphicsSettingsPage.Add('High settings');
  
  // Mentally things are falling apart here
  LowSettingsPic := TBitmapImage.Create(GraphicsSettingsPage);
  LowSettingsPic.Bitmap.LoadFromFile(ExpandConstant('{tmp}\test.bmp'));
  LowSettingsPic.Left := GraphicsSettingsPage.CheckListBox;
end;

My mental model falls apart after loading the file. How would I access the "low" and "high" setting radio button objects on the page and place the respective images by them, either alongside or underneath?


Solution

  • If I understand your question correctly, you are asking how to query position of individual radio buttons. You cannot, there's no API for that. The individual radio buttons are not separate controls, they are all part of one TNewCheckListBox. And it does not have any API to query position of its buttons.

    So all you can do is to start with position of TNewCheckListBox. And measure yourself height of individual list items and add it to the starting position. Use ScaleY to scale the known base size to the font size of the user's machine. It's only approximation. But you cannot get off too much with just two items.

    TCanvas.TextWidth and TCanvas.TextHeight might also be useful.


    Or give up on CreateInputOptionPage/TNewCheckListBox. Instead start with an empty custom page and add your own TRadioButton's. And you will have full control over the positions.

    You can use some of the code from this example:
    TInputDirWizardPage with Radio Buttons