1

In Inno Setup, I removed the border of the window with the formula

WizardForm.BorderStyle: = bsNone; (That works well.)

At present, I would like to move the window with the mouse. I wrote this code under Lazarus, it works fine, but if I apply the same code in Inno Setup, it does not work. Could you help me please, because I can not find the solution. Thank you.

[Code]
procedure InitializeWizard();

//Remove the border of the window.
var
  ClientWidth: Integer;
  ClientHeight: Integer;

begin
  ClientWidth := WizardForm.ClientWidth;
  ClientHeight := WizardForm.ClientHeight;

  WizardForm.BorderStyle := bsNone;

  WizardForm.ClientWidth := ClientWidth;
  WizardForm.ClientHeight := ClientHeight;   
end;

//Move the window with the mouse.
var
  MouseIsDown: boolean;
  PX, PY: integer;

procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button = mbLeft then
  begin
    MouseIsDown := True;
    PX := X;
    PY := Y;
  end;
end;

procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if MouseIsDown then
  begin
    SetBounds(Left + (X - PX), Top + (Y - PY), Width, Height);
  end;
end;

procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  MouseIsDown:=False;
end;

end.

procedure DeInitializeSetup();
begin
end;

// End of file (EOF)
Kai Burghardt
  • 1,046
  • 1
  • 8
  • 23
Eratos
  • 37
  • 1
  • 7
  • Hi Tom, I just tried : begin WizardForm.SetBounds (Left + (X - PX), Top + (Y - PY), Width, Height); end; WizardForm.SetBounds (It works fine.) Thank you for this information. Now Inno Setup displays: Unknown identifier "Left". How to correct this error? – Eratos Dec 06 '18 at 23:58
  • I just tried: Inno Setup does not recognize either: Top, Width, Height. – Eratos Dec 07 '18 at 00:08
  • Hi, Tom. Thanks Tom, because Inno Setup has accepted all the changes. But when the window appears on the screen, I can not move it with the mouse. There is definitely an error in writing the code. (It's amazing, because this code works well under Lazarus (?). Do you have an idea of the problem? – Eratos Dec 07 '18 at 12:08
  • The problem may be with the procedure: procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); Under Lazarus, the procedure indicates the name of the form: TForm1 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); But under Inno Setup, what form name should I put? (The problem must come from there, no?) – Eratos Dec 07 '18 at 12:29
  • Oh, so you are not even getting the mouse events. I looked for previous similar posts and found [this](https://stackoverflow.com/q/13792168/2292722), which effectively also makes your question a duplicate. It doesn't give much hope, but [this recent answer](https://stackoverflow.com/a/53429471/2292722) in the same topic, may help you forward using an add on extension. – Tom Brunberg Dec 07 '18 at 13:19
  • Possible duplicate of [Make Inno Setup WizardForm moveable if titlebar is disabled](https://stackoverflow.com/questions/13792168/make-inno-setup-wizardform-moveable-if-titlebar-is-disabled) – Tom Brunberg Dec 07 '18 at 13:21
  • Thanks for the link, I will read that. I will communicate the result to you when I have tried. – Eratos Dec 07 '18 at 13:54
  • Hi, Tom. Apparently, moving the window does not work under Inno Setup, you have to integrate Graphical Installer. I already used Graphical Installer, to customize a shape. I will try to find the answer under Graphical Installer. If I find the solution, I will give you the result. – Eratos Dec 07 '18 at 14:13
  • You can post an answer to your own question if you find a solution. See [help] and especially [self-answer](https://stackoverflow.com/help/self-answer) – Tom Brunberg Dec 09 '18 at 12:47
  • Yes, I found the solution. I will create a tutorial. Where can I place it, so that interested people read it? – Eratos Dec 09 '18 at 13:23
  • Well, we don't really want to see long winded tutorials. We appreciate if you just answer your own question, to the point. You can do that here below under "Your Answer" – Tom Brunberg Dec 09 '18 at 13:32
  • In the "Answer Your Question" part, can I write all the code part of the solution? – Eratos Dec 09 '18 at 14:07
  • Why not give it a try? – Tom Brunberg Dec 09 '18 at 14:58
  • In this post, I made a mistake in the title, I wrote "Inno Seuto" instead of "Inno Setup", is it possible to correct that? – Eratos Dec 09 '18 at 15:43
  • Sure, look below the `pascal` tag for the "edit" button. Click and the editor opens. – Tom Brunberg Dec 09 '18 at 18:04
  • (Ok, no need to move the discussion.) I thank Tom for his advice. – Eratos Dec 09 '18 at 21:10

1 Answers1

1

Inno Setup - Move the window with the mouse.

Hello everyone,

When we remove the border of the window, it is essential to be able to move it with the mouse.
I send you the solution:
to do this, you must use Inno Setup and Graphical Installer.
It is important to download the latest versions.

Here are the links:
Inno Setup: http://www.jrsoftware.org/
Graphical Installer: http://graphical-installer.com/joomla/index.php/purchase/free-trial

1 / Install the 2 applications.
2 / Copy the code below and paste it into the code part (your script) of Inno Setup.
3 / Run.

[Code]
// Next functions are used for proper working of Graphical Installer powered installer
procedure InitializeWizard();

//This function allows you to delete the border of the window
var
  ClientWidth: Integer;
  ClientHeight: Integer;
begin
  ClientWidth := WizardForm.ClientWidth;
  ClientHeight := WizardForm.ClientHeight;

  WizardForm.BorderStyle := bsNone;

  WizardForm.ClientWidth := ClientWidth;
  WizardForm.ClientHeight := ClientHeight;

//This function allows you to drag the window with the mouse
begin
    #ifdef GRAPHICAL_INSTALLER_PROJECT
    WizardForm.EnableDragging();
    #endif
end;

    #ifdef GRAPHICAL_INSTALLER_PROJECT
    InitGraphicalInstaller();
    #endif
end;

// Next function is used for proper working of Graphical Installer powered installer
procedure CurPageChanged(CurPageID: Integer);
begin
    #ifdef GRAPHICAL_INSTALLER_PROJECT
    PageChangedGraphicalInstaller(CurPageID);
    #endif
end;

// Next function is used for proper working of Graphical Installer powered installer 
procedure DeInitializeSetup();
begin
    #ifdef GRAPHICAL_INSTALLER_PROJECT
    DeInitGraphicalInstaller();
    #endif
end;

// End of file (EOF)

Important:
moving the window activates only by positioning the mouse cursor at the bottom of the window.
You can read this function in the online manual of Graphical Installer.
(See at the bottom of the page, the title "Dragging install window".)

Here is the link :
http://graphical-installer.com/files/manuals/inno/source/html/intro%20-%20project-api.html

Good script to all.

Eratos
  • 37
  • 1
  • 7