6

I have been trying for a while to make the "Select Components" page larger as in the picture below, including the components inner-window (the white one), because I have many components ... and it gets easier to select when it is larger window. If anyone could tell if that's even possible, please give me a hint or point me in a direction.

enter image description here

Thankfully, BeGiN

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
BeGiN
  • 363
  • 3
  • 14
  • Well, it is possible to make the wizard windows higher but you need to resize or shift all the components to keep it good looking. There are many ways to workaround this hard work. 1) get such a very long script, which does it and which someone has to maintain. 2) make the wizard window higher only if the user enters the components page and restore it when they leaves it. 3) make it resizable per request (e.g. by some down looking arrow button shown only on components page). Could you elaborate a bit about your idea ? – TLama Dec 14 '13 at 16:35
  • P.S. consider that resizing may also move the window and also that you should take into account the user's screen height to not make it too high in size because then you might not been able to get to the bottom of the window. – TLama Dec 14 '13 at 16:41
  • First of all , i would want to resize only the component wizard window, your 2nd or 3rd option fits my idea :), if i wanna edit the component wizard can you give me some indications(e.g how to move buttons , how to make the inner white window bigger , etc ) – BeGiN Dec 14 '13 at 17:45
  • You can set it through `WizardForm.Height` property. – TLama Dec 14 '13 at 17:46
  • what is the id of component page? as in wpReady, isn't it wpComponents?:D – BeGiN Dec 14 '13 at 17:54
  • good , managed to make the page bigger http://puu.sh/5MtkN.png – BeGiN Dec 14 '13 at 18:00
  • Great. Now, as you can see you need to move a few components to the bottom and resize the inner page holders. And of course, if you're resizing only this page, you must remember all the original values to restore them back if you leave the page. – TLama Dec 14 '13 at 18:05
  • @TLama why this code wouldn't work ? 'procedure CurPageChanged(CurPageID: Integer); var old_Height: Integer; begin old_Height := WizardForm.Height if CurpageID = wpSelectComponents then begin WizardForm.Height := WizardForm.Height +200; end; WizardForm.Height := old_Height;' – BeGiN Dec 14 '13 at 18:12
  • Because you store and restore wizard form height on all pages. You must do it in a different way. You need to have a global variable and if you'll enter the `wpSelectComponents` page, you first store the original value to that global variable and if the page will be different from `wpSelectComponents` you should restore it. Well, you should not repeat it for every page, so maybe some additional indication would be fine. I mean, e.g. [`this way`](http://pastebin.com/V8jjG7Uj). – TLama Dec 14 '13 at 18:27
  • yep that works like a charm :D can you please tell me how to make the inner window bigger? i think the button i can search to find how to modify position .. but the inner window i searched and couldn't find.. – BeGiN Dec 14 '13 at 18:35
  • The component you're going to resize is `ComponentsList`. Except moving buttons and the bottom bevel, you will need to resize `OuterNotebook`, `InnerNotebook` and move `ComponentsDiskSpaceLabel`. – TLama Dec 14 '13 at 18:56
  • Mission accomplished :D , Thank you very much for your help , i couldn't have done it without you :) http://puu.sh/5Mxyv.png – BeGiN Dec 14 '13 at 19:19
  • You're welcome! You can now post your solution as the answer and accept it, so it can be useful to someone else with the same question. Or you can simply delete the question if you want to. Just, you know, questions without answers are not much useful here :-) Thanks! – TLama Dec 14 '13 at 19:22
  • @TLama can't answer my own question for another 4 hours or so.. because i have too low reputation :( (<10 ) can you post the code from : http://pastebin.com/G6jqEtSG – BeGiN Dec 14 '13 at 19:47
  • Your script is fine and works well. I've posted an alternative which may increase the readability of the script by making some syntactic sugar around. Still, you can wait and then post and accept your own answer. Or just wait for someone else... It's upon you ;-) And forgot to say, welcome to StackOverflow! – TLama Dec 14 '13 at 20:30

2 Answers2

6

Based on your original script I made the following changes. For storing original positions (top and height values) I have used an array of integers and made two general procedures for storing the current positions and for restoring them.

The restoring procedure has the HeightOffset parameter, where you can specify the value, by which all the values from the input array of integers will be increased before they are passed to the wizard form component properties. Except that, I've declared a separate flag indicating that wizard form has modified size.

I used all of this because it improves readability of the script and it's easily extendable for other pages:

[Code]

type
  TPositionStorage = array of Integer;

var
  CompPageModified: Boolean;
  CompPagePositions: TPositionStorage;

procedure SaveComponentsPage(out Storage: TPositionStorage);
begin
  SetArrayLength(Storage, 10);

  Storage[0] := WizardForm.Height;
  Storage[1] := WizardForm.NextButton.Top;
  Storage[2] := WizardForm.BackButton.Top;
  Storage[3] := WizardForm.CancelButton.Top;
  Storage[4] := WizardForm.ComponentsList.Height;
  Storage[5] := WizardForm.OuterNotebook.Height;
  Storage[6] := WizardForm.InnerNotebook.Height;
  Storage[7] := WizardForm.Bevel.Top;
  Storage[8] := WizardForm.BeveledLabel.Top;
  Storage[9] := WizardForm.ComponentsDiskSpaceLabel.Top;
end;

procedure LoadComponentsPage(const Storage: TPositionStorage;
  HeightOffset: Integer);
begin
  if GetArrayLength(Storage) <> 10 then
    RaiseException('Invalid storage array length.');

  WizardForm.Height := Storage[0] + HeightOffset;
  WizardForm.NextButton.Top := Storage[1] + HeightOffset;
  WizardForm.BackButton.Top := Storage[2] + HeightOffset;
  WizardForm.CancelButton.Top := Storage[3] + HeightOffset;
  WizardForm.ComponentsList.Height := Storage[4] + HeightOffset;
  WizardForm.OuterNotebook.Height := Storage[5] + HeightOffset;
  WizardForm.InnerNotebook.Height := Storage[6] + HeightOffset;
  WizardForm.Bevel.Top := Storage[7] + HeightOffset;
  WizardForm.BeveledLabel.Top := Storage[8] + HeightOffset;
  WizardForm.ComponentsDiskSpaceLabel.Top := Storage[9] + HeightOffset;
end;

procedure InitializeWizard;
begin
  CompPageModified := False;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurpageID = wpSelectComponents then
  begin
    SaveComponentsPage(CompPagePositions);
    LoadComponentsPage(CompPagePositions, ScaleY(200));
    CompPageModified := True;
  end
  else
  if CompPageModified then
  begin
    LoadComponentsPage(CompPagePositions, 0);
    CompPageModified := False;
  end;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
TLama
  • 75,147
  • 17
  • 214
  • 392
0

Inno Setup 6 has component alignment set correctly. So all you need to do is to set wizard form larger.

Thanks for that the code by TLama reduces to:

var
  CompPageModified: Boolean;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurpageID = wpSelectComponents then
  begin
    WizardForm.Height := WizardForm.Height + ScaleY(200);
    CompPageModified := True;
  end
    else
  if CompPageModified then
  begin
    WizardForm.Height := WizardForm.Height - ScaleY(200);
    CompPageModified := False;
  end;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992