Skip to content

Instantly share code, notes, and snippets.

View LilyStilson's full-sized avatar
💙

Alice LilyStilson

💙
View GitHub Profile
@LilyStilson
LilyStilson / FMX.TabControl.pas
Last active August 31, 2023 18:53
FMX TabControl Transition and Duration mod
procedure TTabControl.SetActiveTabWithTransitionAsync(const ATab: TTabItem; const ATransition: TTabTransition;
const ADirection: TTabTransitionDirection; const AType: TAnimationType; const AInterpolation: TInterpolationType; const ADuration: Single; const AOnFinish: TProc);
procedure AnimateControlPositionX(AParent: TFmxObject; const NewValue: Integer;
const AProgressHandler: TNotifyEvent; const AFinishHandler: TNotifyEvent);
var
A: TIntAnimation;
begin
TAnimator.StopPropertyAnimation(AParent, 'Position.X');
@LilyStilson
LilyStilson / CaptureConsoleOutput.pas
Last active November 22, 2021 09:54
Procedure that redirects console output to the callback procedure line by line. Tested with Delphi 11.0 Alexandria (Windows 11, macOS 11).
uses
System.SysUtils, System.Classes, System.Threading,
{$IFDEF MSWINDOWS}
Winapi.Windows;
{$ELSE POSIX}
Posix.Base;
{$ENDIF}
type
TConsoleCallback<T> = reference to procedure(Line: T);
@LilyStilson
LilyStilson / Unit1.pas
Created September 28, 2020 14:42
FireMonkey TComboEdit RSP-29429 bug workaround
// RAD Studio 10.4
unit Unit1;
uses
FMX.Types, FMX.Controls, FMX.Forms, FMX.ComboEdit, FMX.Text;
type
TComboEdit = class(TCustomComboEdit)
procedure OnValidateEvent(Sender: TObject; var Text: string);
procedure OnValidatingEvent(Sender: TObject; var Text: string);
@LilyStilson
LilyStilson / FavoriteButtonStyle.xaml
Last active May 3, 2020 04:57
Custom AppBarToggleButton style made for favorite/unfavorite action
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Favorite/Unfavorite button style. Text are predefined and thus shall not be changed. -->
<Style x:Key="FavoriteButtonRevealStyle" TargetType="AppBarToggleButton">
<Setter Property="Foreground" Value="{ThemeResource AppBarToggleButtonForeground}"/>
<Setter Property="BorderBrush" Value="{ThemeResource AppBarToggleButtonRevealBorderBrush}"/>
<Setter Property="BorderThickness" Value="{ThemeResource AppBarToggleButtonRevealBorderThemeThickness}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Top"/>
@LilyStilson
LilyStilson / uNSAppSample.pas
Last active March 19, 2020 00:04 — forked from freeonterminate/uNSAppSample.pas
Sample calling the OSX / Objective-C runtime library in Delphi
//Forked from freeonterminate (Hosokawa Jun)
//Translated by LilyStilson
unit uNSAppSample;
interface
implementation
{$IFDEF MACOS}