working on it ...

Filters

Explore Public Snippets

Sort by

Found 9 snippets matching: firemonkey

    public by FMXExpress modified Nov 13, 2014  9165  92  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  7319  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  4331  20  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  4766  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  677  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  156  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;
    
    

    external by StackOverflow modified Feb 17, 2015  1  0  2  0

    FireMonkey TClientDataSet Setting a Filter causes "Error Creating cfString" in OSX works fine in Windows

    I am having a problem setting a filter on a TClientDataSet when running on Mac OSX. It works fine on Windows. I get the error: Error Creating cfString This is really easy for me to duplicate: Create a new project. Go to the Project - Deployment menu item Click the Add Featured Files button Select Midas Library option and click OK Add a TClient
    /* 
    This is a known problem that has already been reported to Embarcadero:
    
    [MacOS] OS X 10.10 - Error Creating CFString
    
    Oh wait, that ticket has an example that looks surprisingly like your code above :)
     */
    

    external by StackOverflow modified Jul 1, 2016  1  0  2  0

    TClientDataset in OS X Firemonkey App

    I have a Windows Firemonkey app that uses TClientDatasets to load XML data files that I'm trying to get to work on OS X. The data files are stored on a Windows file share so multiple users can access the same data (I'm not concerned about concurrency issues here). I can't seem to get the mac version load the files from the server - it seems to aut
    /* 
    I had a similar problem and worked it out by creating one tcp server on the windows side and one tcp client on the client side.. and sending the xml file through streams.. works like a charm ...
     */
    

    List Complete ( 9 snippets total )

    • Public Snippets
    • Channels Snippets