working on it ...

Filters

Explore Public Snippets

Sort by

Found 7 snippets matching: firemonkey

    public by FMXExpress modified Nov 13, 2014  8979  90  7  1

    Non Blocking Message Dialog For Delphi XE7 Firemonkey

    MessageDlg(‘Do you want to press yes or no?’, System.UITypes.TMsgDlgType.mtInformation,
      [System.UITypes.TMsgDlgBtn.mbYes, System.UITypes.TMsgDlgBtn.mbNo], 0,
        procedure(const AResult: TModalResult)
        begin
          case AResult of
            { Detect which button was pushed and show a different message }
            mrYes:
                begin
                // pressed yes
                end;
            mrNo:
                begin
                // pressed no
                end;
          end;
        end
      );
    // code here would get executed right away

    public by FMXExpress modified Nov 12, 2014  7061  9  9  4

    Install A Shortcut On Android With Delphi XE5 Firemonkey

    http://www.fmxexpress.com/install-shortcuts-on-the-android-home-screen-with-delphi-xe5-firemonkey/
    //Android permission required:
    //<uses-permission android:name=”com.android.launcher.permission.INSTALL_SHORTCUT”/>
        
    Uses
    Androidapi.JNI.GraphicsContentViewText, FMX.Helpers.Android,
    Androidapi.JNI.JavaTypes, FMX.Platform.Android, AndroidApi.JniBridge, AndroidApi.Jni.App,
    AndroidAPI.jni.OS;
    
    {$IFDEF ANDROID}
    var
    ShortcutIntent: JIntent;
    addIntent: JIntent;
    wIconIdentifier : integer;
    wIconResource : JIntent_ShortcutIconResource;
    {$ENDIF}
    begin
    {$IFDEF ANDROID}
    
    ShortcutIntent := TJIntent.JavaClass.init(SharedActivityContext, SharedActivityContext.getClass);
    ShortcutIntent.setAction(TJIntent.JavaClass.ACTION_MAIN);
    
    addIntent := TJIntent.Create;
    addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_INTENT, TJParcelable.Wrap((shortcutIntent as ILocalObject).GetObjectID));// here we need to cast the intent as it’s not done in delphi by default, not like java
    addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_NAME, StringToJString(Application.Title));
    addIntent.setAction(StringToJString(‘com.android.launcher.action.INSTALL_SHORTCUT’));
    // get icon resource identifier
    wIconIdentifier := SharedActivity.getResources.getIdentifier(StringToJString(‘ic_launcher’), StringToJString(‘drawable’), StringToJString(‘com.embarcadero.HeaderFooterApplication’)); // if the app name change, you must change the package name
    wIconResource := TJIntent_ShortcutIconResource.JavaClass.fromContext(SharedActivityContext, wIconIdentifier);
    // set icon for shortcut
    addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_ICON_RESOURCE, TJParcelable.Wrap((wIconResource as ILocalObject).GetObjectID));
    
    SharedActivityContext.sendBroadcast(addIntent);
    
    {$ENDIF}
     

    public by FMXExpress modified Nov 12, 2014  4168  17  6  1

    Decode GZIP Content From TRESTClient In Delphi XE7 Firemonkey

    RESTClient.AcceptEncoding := 'gzip, deflate';
    RESTClient.Execute;
    
    if RESTResponse.ContentEncoding=’gzip’ then
    DecodeGZIPContent(RESTResponse.RawBytes) // decode and do something with the content
    else
    RESTResponse.Content; // do something with the content
    
    function DecodeGZIPContent(RawBytes: System.TArray<System.Byte>): String;
    var
    MSI: TMemoryStream;
    MSO: TStringStream;
    begin
    MSI := TMemoryStream.Create;
    MSO := TStringStream.Create;
    MSI.WriteData(RawBytes,Length(RawBytes));
    MSI.Seek(0,0);
    // Zlib is a TIdCompressorZlib
    Zlib.DecompressGZipStream(MSI,MSO);
    MSI.DisposeOf;
    MSO.Seek(0,0);
    Result := MSO.DataString;
    MSO.Free;
    end;

    public by FMXExpress modified Nov 12, 2014  4624  2  7  1

    Process Strings Using A Parallel For Loop In Delphi XE7 Firemonkey

    TParallel.For(0,1000,
     procedure(I: Integer)
      begin
       TThread.Queue(TThread.CurrentThread,
        procedure
         begin
          Memo1.Lines.Append(I.ToString);
         end);
      end);

    external by Haruyuk Mohri modified Jul 24, 2015  652  0  3  0

    C++Builder XE8 (Win32) FireMonkey Form->Sort() template

    C++Builder XE8 (Win32) FireMonkey Form-Sort() template: form_sort_template.cpp
    //typedef int __fastcall TFmxObjectSortCompare(TFmxObject* Item1, TFmxObject* Item2);
    enum _DummyType{};
    template <typename INTF, typename Sorty,
    	typename R,
    	typename P1 = _DummyType,
    	typename P2 = _DummyType>
    class TAho : public TCppInterfacedObject<INTF>
    {
    private:
    	Sorty callback;
    public:
    	TAho(Sorty _callback){}// : callback(_callback) {}
    	INTFOBJECT_IMPL_IUNKNOWN(TInterfacedObject);
    
    	R __fastcall Invoke(P1* p1, P2* p2)
    	{
    		return callback(p1,p2);
    	}
    };
    
    
    

    external by Horácio Filho (Fofofly) modified Feb 23, 2016  185  0  2  0

    Delphi FireMonkey

    Delphi FireMonkey: gistfile1.txt
    http://www.gesource.jp/weblog/?tag=delphi
    
    

    external by ortuagustin modified Aug 21, 2016  144  0  2  0

    Firemonkey constraint

    Firemonkey constraint: FMX.Layout.Constraint.pas
    // Source: http://delphiaccess.com/foros/index.php/topic/12206-alguien-conoce-algo-análogo-a-constraint-de-vcl/
    // Author: @genriquez
    
    unit FMX.Layout.Constraint;
    
    type
      TLayout = class(FMX.Layouts.TLayout)
      private
        FConstraint: TPoint;
        procedure SetConstraint(const Value: TPoint);
      protected
         procedure HandleSizeChanged; Override;
      public
         Property Constraint: TPoint read FConstraint write SetConstraint;
      end;
    
    implementation
    
    { TLayout }
     
    procedure TLayout.HandleSizeChanged;
    begin
      If (FConstraint.X > 0) and (Width < FConstraint.X) then
         Width := FConstraint.X;
     
      If (FConstraint.Y > 0) and (Height < FConstraint.Y) then
         Height := FConstraint.Y;
     
      inherited;
    end;
     
    procedure TLayout.SetConstraint(const Value: TPoint);
    begin
      FConstraint := Value;
    end;
    
    

    List Complete ( 7 snippets total )

    • Public Snippets
    • Channels Snippets