Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #18  
Old 30-07-2022, 10:07
Carldric Clement's Avatar
Carldric Clement Carldric Clement is offline
Registered User
 
Join Date: Aug 2014
Location: Toboh, Sabah, Malaysia
Posts: 596
Thanks: 599
Thanked 659 Times in 234 Posts
Carldric Clement is on a distinguished road
Quote:
Originally Posted by Razor12911 View Post
I am not sure how far you have gone with development however there are some information that could be helpful which I'd like to share as I've created a similar project for installer creator once before.

Colors used by FireMonkey framework are reversed compared to VCL (what Inno uses) so the function RGBtoBGR will be useful to you when you decide to add color picker.

The font sizes are different as well because the DPI used in VCL (72 dpi) is different from FMX (96 dpi) whatever font values used during design mode should be multiplied by the factor 72/96 and by 96/72 when going from inno to fmx.

In order to make the code for paging through the wizard simple (welcome, system, install), introduce TTabControl and make tabs for each one of these pages and to make the tabcontrol itself transparent, you'll need to set its StyleLookup property to "transparentedit", this applies to everything that you want to make transparent in FMX, just set the StyleLookup value to this vale.

To get a list of fonts supported by Fmx you should use Printer from FMX.Printers.Win

Code:
var
  Printer: TPrinterWin;
begin
  Printer := TPrinterWin.Create; 
  ComboBox1.BeginUpdate;
  try
    ComboBox1.Items.AddStrings(Printer.Fonts);
  finally
    ComboBox1.EndUpdate;
  end;
  Printer.Free;
It's wise to introduce class objects for things such as buttons because not only does this mean you'll write less code but this way you can consolidate any bugs/issues encountered with one simple fix.

Something like this:
Code:
type
  TDesignButton = class(TSelection)
  private
    FRectangle: TRectangle;
    FLabel: TLabel;
    procedure MyMouseEnter(Sender: TObject);
    procedure MyMouseLeave(Sender: TObject);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure SetText(AText: String);
    procedure SetFont(AName: String; ASize: Single; AColor: TAlphaColor);
    procedure SetFontStyle(ABold, AItalic: Boolean);
    procedure SetAlignment(AHorzAlign, AVertAlign: TTextAlign;
      AOffsetX, AOffsetY: Single);
    procedure SetImage(AFilename: String);
  end;

constructor TDesignButton.Create(AOwner: TComponent);
begin
  inherited Create(Owner);
  Self.HideSelection := True;
  Self.ShowHandles := False;
  Self.OnMouseEnter := MyMouseEnter;
  Self.OnMouseLeave := MyMouseLeave;
  FRectangle := TRectangle.Create(Self);
  FRectangle.Parent := Self;
  FRectangle.Align := TAlignLayout.Client;
  FRectangle.HitTest := False;
  FRectangle.Fill.Bitmap.WrapMode := TWrapMode.TileStretch;
  FRectangle.Stroke.Thickness := 0;
  FLabel := TLabel.Create(FRectangle);
  FLabel.Parent := FRectangle;
  FLabel.Align := TAlignLayout.Client;
  FLabel.HitTest := False;
  FLabel.Text := '';
  FLabel.StyledSettings := [];
end;

destructor TDesignButton.Destroy;
begin
  inherited Destroy;
end;

procedure TDesignButton.MyMouseEnter(Sender: TObject);
begin
  Self.HideSelection := False;
  Self.ShowHandles := True;
end;

procedure TDesignButton.MyMouseLeave(Sender: TObject);
begin
  Self.HideSelection := True;
  Self.ShowHandles := False;
end;

procedure TDesignButton.SetText(AText: String);
begin
  FLabel.Text := AText;
end;

procedure TDesignButton.SetFont(AName: String; ASize: Single;
  AColor: TAlphaColor);
begin
  FLabel.Font.Family := AName;
  FLabel.Font.Size := ASize;
  FLabel.FontColor := AColor;
end;

procedure TDesignButton.SetFontStyle(ABold, AItalic: Boolean);
begin
  FLabel.Font.Style := [];
  if ABold then
    FLabel.Font.Style := FLabel.Font.Style + [TFontStyle.fsBold];
  if AItalic then
    FLabel.Font.Style := FLabel.Font.Style + [TFontStyle.fsItalic];
end;

procedure TDesignButton.SetAlignment(AHorzAlign, AVertAlign: TTextAlign;
  AOffsetX, AOffsetY: Single);
begin
  FLabel.TextAlign := AHorzAlign;
  FLabel.VertTextAlign := AVertAlign;
  FLabel.Margins.Left := AOffsetX;
  FLabel.Margins.Right := -AOffsetX;
  FLabel.Margins.Top := AOffsetY;
  FLabel.Margins.Bottom := -AOffsetY;
end;

procedure TDesignButton.SetImage(AFilename: String);
begin
  FRectangle.Fill.Kind := TBrushKind.Bitmap;
  FRectangle.Fill.Bitmap.Bitmap.LoadFromFile(AFilename);
end;
with its usage being:
Code:
var
  BackButton, NextButton: TDesignButton;

procedure TForm2.FormShow(Sender: TObject);
begin
  BackButton := TDesignButton.Create(Form2);
  BackButton.Parent := Form2;
  BackButton.SetBounds(20, 20, 100, 30);
  BackButton.SetText('Back');
  BackButton.SetFont('Agency FB', 14, claGreen);
  BackButton.SetFontStyle(True, False);
  BackButton.SetAlignment(TTextAlign.Center, TTextAlign.Center, -10, 0);
  BackButton.SetImage('back.png');

  NextButton := TDesignButton.Create(Form2);
  NextButton.Parent := Form2;
  NextButton.SetBounds(140, 20, 100, 30);
  NextButton.SetText('Next');
  NextButton.SetFont('Agency FB', 14, claDeepPink);
  NextButton.SetFontStyle(True, False);
  NextButton.SetAlignment(TTextAlign.Center, TTextAlign.Center, 10, 0);
  NextButton.SetImage('Next.png');
end;
I have uploaded a compiled demo of what to expect as a result, but you can improve upon this by introducing Get* functions, eg. GetText, GetFontName, GetFontSize etc etc....
Thanks for the information bro. Time to change a lot of code where I use the TImage from.
Attached Images
File Type: jpg Screenshot 2022-07-31 014334.jpg (29.4 KB, 273 views)

Last edited by Carldric Clement; 31-07-2022 at 01:21.
Reply With Quote
 

Tags
ciu designer, ciu v3

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Game Installer Designer by altef_4 altef_4 Conversion Tutorials 236 28-05-2021 02:54
Repetitive vs Stretching Progress Bar Cuttlas Conversion Tutorials 0 10-11-2020 07:14
Unpack files with progress in batch gozarck Conversion Tutorials 3 29-06-2016 12:38
Progress bar for Tasks danswano PC Games - CD/DVD Conversions 22 09-03-2013 12:09



All times are GMT -7. The time now is 11:43.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com