working on it ...

Filters

Explore Public Snippets

Sort by

Found 649 snippets matching: delphi

    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 fets modified Mar 29, 2016  160  0  2  0

    Delphi Version Compiler Directives

    Delphi Version Compiler Directives: Delphi Version Compiler Directives
    {$IFDEF VER80} ShowMessage('Delphi 1');{$ENDIF}
    {$IFDEF VER90} ShowMessage('Delphi 2');{$ENDIF}
    {$IFDEF VER100} ShowMessage('Delphi 3');{$ENDIF}
    {$IFDEF VER120} ShowMessage('Delphi 4');{$ENDIF}
    {$IFDEF VER130} ShowMessage('Delphi 5');{$ENDIF}
    {$IFDEF VER140} ShowMessage('Delphi 6');{$ENDIF}
    {$IFDEF VER150} ShowMessage('Delphi 7');{$ENDIF}
    {$IFDEF VER160} ShowMessage('Delphi 8');{$ENDIF}
    {$IFDEF VER170} ShowMessage('Delphi 2005');{$ENDIF}
    {$IFDEF VER180} ShowMessage('Delphi 2006');{$ENDIF}
    {$IFDEF VER185} ShowMessage('Delphi 2007');{$ENDIF}
    {$IFDEF VER200} ShowMessage('Delphi 2009');{$ENDIF}
    {$IFDEF VER210} ShowMessage('Delphi 2010');{$ENDIF}
    {$IFDEF VER220} ShowMessage('Delphi XE');{$ENDIF}
    {$IFDEF VER230} ShowMessage('Delphi XE2');{$ENDIF}
    {$IFDEF VER240} ShowMessage('Delphi XE3');{$ENDIF}
    {$IFDEF VER250} ShowMessage('Delphi XE4');{$ENDIF}
    {$IFDEF VER260} ShowMessage('Delphi XE5');{$ENDIF}
    {$IFDEF VER270} ShowMessage('Delphi XE6');{$ENDIF}
    
    if CompilerVersion = 20 then sCompilerName := 'Delphi 2009';
    
    or in conditional compiler expressions:
    
    {$if CompilerVersion > 18} // Delphi 2007 or later {$ifend} 
    
    Compiler 	      CompilerVersion 	Defined Symbol
    Delphi XE6		27 		VER270
    Delphi XE5		26 		VER260
    Delphi XE4		25 		VER250
    Delphi XE3		24 		VER240
    Delphi XE2		23 		VER230
    Delphi XE		22 		VER220
    Delphi 2010 	  	21 		VER210
    Delphi 2009		20 		VER200
    Delphi 2007 .NET 	19 		VER190
    Delphi 2007 		18.5 	VER185
    Delphi 2006 		18 		VER180
    Delphi 2005 		17 		VER170
    Delphi 8 .NET 		16 		VER160
    Delphi 7 		15 		VER150
    Delphi 6 		14 		VER140
    Delphi 5 		13 		VER130
    Delphi 4 		12 		VER120
    Delphi 3 		10 		VER100
    Delphi 2 	      	9 		VER90
    Delphi 1 		8 		VER80 
    
    

    external by jacobthurman modified Dec 26, 2013  72342  0  4  0

    Quick Delphi plugin to change font size in the Object Inspector. Not perfect, has quirks. Use at your own risk.

    Quick Delphi plugin to change font size in the Object Inspector. Not perfect, has quirks. Use at your own risk.: OIFontTweakMain.pas
    unit OIFontTweakMain;
    
    interface
    
    uses Vcl.Forms, Vcl.Controls, Vcl.Dialogs, Vcl.StdCtrls;
    
    procedure Register;
    
    implementation
    
    function GetOIForm: TForm;
    var
      I: Integer;
    begin
      Result := nil;
      for I := 0 to Screen.FormCount - 1 do
      begin
        if Screen.Forms[I].Name = 'PropertyInspector' then
        begin
          Result := Screen.Forms[I];
          Exit;
        end;
      end;
    end;
    
    function GetChildControl(AParent: TWinControl; AName: string): TWinControl;
    var
      I: Integer;
    begin
      Result := nil;
      for I := 0 to AParent.ControlCount - 1 do
      begin
        if AParent.Controls[I].Name = AName then
        begin
          Result := TWinControl(AParent.Controls[I]);
          Exit;
        end;
      end;
    end;
    
    function GetOIControl: TCustomListBox;
    var
      OIForm: TForm;
    begin
      OIForm := GetOIForm;
      Result := TCustomListBox(GetChildControl(GetChildControl(OIForm,
                'Panel3'), 'PropList'));
    end;
    
    procedure Register;
    var
      I, J: Integer;
      OI: TListBox;
    begin
      OI := TListBox(GetOIControl);
      OI.Font.Size := 14;
      OI.ItemHeight := 24;
    end;
    
    end.
    
    

    external by dialex modified Apr 17, 2015  91  0  1  0

    SVN global-ignore: general, delphi, visual studio

    SVN global-ignore: general, delphi, visual studio: svnignore
    #*# *.*~ *.apk *.bak *.bpi *.bpl *.cfg *.class *.csproj.user *.dcp *.dcu *.dll *.drc *.dres *.dsk *.exe *.exp *.generated.cs *.idb *.identcache *.ilk *.la *.lib *.lo *.local *.log *.map *.meta *.mine *.msi* *.ncb *.o *.obj *.pch *.pdb *.pgc *.pgd *.pidb *.projdata *.rej *.rsm *.rsp *.sbr *.scc *.sln.docstates *.so *.stat *.suo *.svclog *.tds *.tlb *.tlh *.tli *.tmp *.tmp_proj *.tvsconfig *.user *.userosscache *.userprefs *.VisualState.xml *.vspscc *.vssscc *.~* *Resource.rc *_i.c *_i.h *_p.c *~ .#* .*.rej .*~ .builds .CVS .DS_Store .res .vs/ bld/ build/ cvs dlldata.c TestResult.xml x64/ x86/ [Bb]in/ [Bb]uild[Ll]og.* [Dd]ebug/ [Dd]ebugPS/ [Dd]ebugPublic/ [Oo]bj/ [Rr]elease/ [Rr]eleasePS/ [Rr]eleases/ [Tt]est[Rr]esult*/ [Tt]humbs.db __history/ ~*.* 
    
    

    external by Github modified Jun 14, 2016  57  0  1  0

    I like watching TV <a href=" http://eastlondondance.org/bupropion-cost-uk.pdf#furious ">bupropion for sale uk</a> Steubing analyst Tobias Schmidt said investors should notforget that U.S. rival Delphi was likely to continuebeating Leoni in terms of ma...

    I like watching TV bupropion for sale uk Steubing analyst Tobias Schmidt said investors should notforget that U.S. rival Delphi was likely to continuebeating Leoni in terms of margins even after the German grouphits 2016 medium-term goals. : Haley
    I like watching TV <a href=" http://eastlondondance.org/bupropion-cost-uk.pdf#furious ">bupropion for sale uk</a>  Steubing analyst Tobias Schmidt said investors should notforget that U.S. rival Delphi was likely to continuebeating Leoni in terms of margins even after the German grouphits 2016 medium-term goals.
     
    
    

    external by cnsoft modified Jun 28, 2013  2442  4  4  0

    Last step of admob integrated with delphi xe4.

    Last step of admob integrated with delphi xe4.: gistfile1.txt
    setense: 
    
    Undefined symbols for architecture armv7s:
      "_OBJC_CLASS_$_ASIdentifierManager", referenced from:
    
    Undefined symbols for architecture armv7
    
    http://www.cocoachina.com/bbs/simple/?t117929.html
    xiasix	2012-11-20 12:31
    If you're using the Admob v6.2 library make sure you're NOT using the -all_load linker flag, use the -ObjC linker flag instead.  这个原因 找到了
    
    xe4 怎么办呢?
    
    I got this error. 
    "_OBJC_CLASS_$_ASIdentifierManager", referenced from:
    
    #try to add this line to loaded symboal?
    function XE4_FakeLoader : ZBarReaderView; cdecl; external 'libzbar.a' name 'OBJC_CLASS_$_ZBarReaderView';
    [출처] Delphi XE4 with iOS / #07. ZBar Interface|작성자 최원식옹
    
    
    //Important Step. 
    
    //  Adding "iAd" Framework
    //    Step 1. Select Tools - Options - SDK Manager
    //    Step 2. Add Framework   /System/Library/Frameworks  iAd
    //    Step 3. Update Local File Cache//
    //
    [출처] Delphi XE4 with iOS / #13. Procedure for adding Apple Framework|작성자 최원식옹
    
    
    http://blog.naver.com/PostView.nhn?blogId=simonsayz&logNo=120190032530&parentCategoryNo=20&categoryNo=&viewDate=&isShowPopularPosts=false&from=postView
    
    //    2.2. Static Library /WO Source
    //         Find Any Class Symbol in *.a , and Define func.
    //         To Find Class Symbol : NM libtest.a [Enter]
    //         function XE4_FakeLoader : mycalc; cdecl; external 'libtest.a' name 'OBJC_CLASS_$_mycalc';
    [출처] Delphi XE4 with iOS / #05. Hybrid Coding with Objective C Static Library |작성자 최원식옹
    
    
    //
    http://sourceforge.net/projects/dpfdelphiios/files/latest/download
    //how to add more framework. (step)
    
    
    

    external by martinusso modified Aug 10, 2016  22  0  1  0

    Delphi Email Address Validator

    Delphi Email Address Validator: emailAdressValidator
    {
      uses RegularExpressions;
    }
    
    function ValidateEmail(const emailAddress: string): Boolean;
    var
      RegEx: TRegEx;
    begin
      RegEx := TRegex.Create('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]*[^.+-]+$');
      Result := RegEx.Match(emailAddress).Success;
    end;
    
    
    • Public Snippets
    • Channels Snippets