|
#11
|
|||
|
|||
|
Custom Slideshow and Generic WebView Example
Real life examples are in Epic Games Installer
Generic WebView Example You can reuse the attached WebView.html like this: Code:
[Files]
Source: "Files\Web\WebView.html"; DestDir: "{tmp}"; Flags: dontcopy;
Code:
procedure LoadHtmlContent(Width, Height: Integer; SrcURL: WideString);
var
sHtml, VideoId: Widestring;
sTemplate: AnsiString;
Sl: TStringList;
begin
VideoId := Copy(SrcURL, Pos('v=', SrcURL) + 2, 11);
LoadStringFromFile(ExtractAndLoad('WebView.html'), sTemplate);
sHtml := Format(sTemplate, [Width, Height, VideoId]);
Sl := TStringList.Create;
try
Sl.Text := sHtml;
Sl.SaveToFile(ExpandConstant('{tmp}\WebView.html'));
finally
Sl.Free;
end;
end;
Code:
LoadHtmlContent(680, 384, 'https://www.youtube.com/ watch?v=hS7ZY7oLCS4&ab_channel=RANDOMGAMERTAGS');
TrailerRect.FCreate(FMXForm.Handle);
TrailerRect.SetBounds(250, 145, 680, 383);
TrailerRect.Opacity(0);
TrailerRect.HitTest(False);
TrailerWebView.FCreate(FMXForm.Handle, TrailerRect.Handle, ExpandConstant('{tmp}\WebView.html'));
TrailerWebView.Start;
The need for this was because both type of Image Slideshow were dependent on FMXForm and couldn't be overlayed with a different component. Hence, I had to go with creating my own. Code:
j: Integer; GameImage: FImage; SlideShowTimer: FTimer; Code:
GameImage.FCreate(FMXForm.Handle);
GameImage.SetBounds(250, 145, 680, 383);
GameImage.LoadPicture(ExtractAndLoad('Image0.jpg'), iwStretch);
GameImage.Opacity(1);
SlideShowTimer.FCreate(GameImage.Handle, True);
SlideShowTimer.Interval(100);
SlideShowTimer.OnTimer(@ChangeSlide);
Code:
procedure ChangeSlide(Sender: TObject);
var
Time: Cardinal;
SlideOpacity: Single;
begin
if GameImage.GetOpacity = 1 then Slider := False
else if GameImage.GetOpacity = 0 then begin
GameImage.LoadPicture(ExtractAndLoad('Image' + IntToStr(j) +'.jpg'), iwStretch);
j := j+1;
Slider := True;
end;
if (Slider = False) and not (GameImage.GetOpacity = 0) then SlideOpacity := GameImage.GetOpacity - 0.05
else if (Slider = True) and not(GameImage.GetOpacity = 1) then SlideOpacity := GameImage.GetOpacity + 0.05;
GameImage.Opacity(SlideOpacity);
#ifdef NumberOfSlides
if j = {#NumberOfSlides} then j := 0;
#endif
end;
Settings.ini has a parameter as Number of Slides where you need to define the number of Image Files from the folder, to be included in the slideshow. Last edited by Fak Eid; 05-08-2024 at 07:59. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Windows Fluent Effects Standalone API - InnoSetup / VCL / FXM | BLACKFIRE69 | Conversion Tutorials | 0 | 15-11-2023 17:35 |
| Windows Phone Installer similar to razor12911's original design? | Kitsune1982 | Conversion Tutorials | 0 | 02-07-2020 13:04 |
| INDEX - Conversion Tutorial Index | Razor12911 | Conversion Tutorials | 5 | 11-06-2020 02:05 |
| Frequently Asked Questions | Joe Forster/STA | PC Games - Frequently Asked Questions | 0 | 29-11-2005 09:48 |