Quantcast
Channel: Delphi Forum - Delphi Programming Kings of Code - Delphi Programming
Viewing all 173 articles
Browse latest View live

Use SKINS and RIBBON DevExpress in Forms

$
0
0
The beggin of my projects, is simple: (the names of Forms you can change, of your way)

0 - my Directory Structure:
c:\NameApplication\PRJ\(my project files and sub-folders (Win32\Debug or Release, example) to DCU and another binary files)
c:\NameApplication\EXE\(my app.exe)
c:\NameApplication\SKN\(all *.SKINRES files, except ALLSKINS.SKINRES hehehehe)
c:\NameApplication\FRM\(all *.frm and .pas files)
c:\NameApplication\DB\(myDatabase.FDB (firebird))
c:\NameApplication\DM\(all my DataModules)
etc...
So, my project stay clean and easy for maintenance

1 - 1 DataModule for "my components of Support" (all components that not use Database needs) - my "dmSuporteGeral.pas"
ex.: TdxSkinController for example... etc!

2 - 1 DataModule for "my components for Database manipulation" (all components that use Database needs) - my "dmDBprincipal.pas"
ex.: TFIBTable, TFIBDatabase, etc...!

3 - 1 Form with definitions general to create anothers forms in my projects. I always call it of: fFRMBaseGeral.pas
ex.: this form will content my primary definitions, as: TdxRibbon, TdxRibbonStatusBar, TdxBarManager (important for dxRibbon use), etc...
and my events implementation, as: onFormCreate, onFormClose, etc...
Without TdxBarManager component in your project with TdxRibbon, you'll have a "Access Violation" error!

4 - So, we have: 2 DataModule and 1 Form (primary)

5 - My fFRMBaseGeral is descendent from "TdxRibbonForm", or be, TfFRMBaseGeral = class(TdxRibbonForm). So, I can use all property and another definitions from
"DevExpress Form", as the property: DisableAero := True;

6 - The sequence for "AUTO-CREATE FORMS" is only 2 forms (1 datamodule and 1 form):
1º - DMSuporte
2º - FRMMainExec (my form main)

The Form "FRMBaseGeral" is not AUTO-CREATED ok!, as anothers forms in project!

7 - In my example, see that I use just little components ok!

------------------------- My DataModule Support Generic ------------- AUTO-CREATE --------------------

Code:
unit uDMSuporte;

interface

uses
System.SysUtils, System.Classes, Vcl.Dialogs, Vcl.Forms, {for use generic = procedures, functions, variables, consts, etc...}
//
dxSkinsCore, cxClasses, cxLookAndFeels, dxSkinsForm {because of Skins components hehehe}
//
;
type
TDMSuporte = class(TDataModule)
dxSkinController1: TdxSkinController; // component
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
DMSuporte: TDMSuporte;

implementation

{ %CLASSGROUP 'Vcl.Controls.TControl' } // for use of "Pallete Controls"

{$R *.dfm}

uses
uFNCgeral; //my generic unit of functions

procedure TDMSuporte.DataModuleCreate(Sender: TObject);
begin
//
// DMSuporte.dxSkinController1.SkinName := 'UserSkin';
//
if dxSkinController1.UseSkins then
UsarSkinsNoAplicativo; //procedure in "uFNCgeral.pas"
end;

end.


---------------------------- My Form Base to all anothers Forms ------------- NOT AUTO-CREATE -----------------

Code:
unit uFRMBaseGeral;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
//
cxControls, cxClasses, cxGraphics, cxLookAndFeels,
//
cxLookAndFeelPainters, dxSkinsDefaultPainters, dxSkinsdxBarPainter, {Painters needs for my project}
dxSkinsdxRibbonPainter,
//
dxSkinsCore, dxRibbonSkins,
//
dxRibbonCustomizationForm, dxRibbon, dxBar, dxStatusBar, dxRibbonStatusBar,
//
dxRibbonForm {Class parent of my Main Form}
//
;

type
TfFRMBaseGeral = class(TdxRibbonForm) // my form (class) inherited
dxRibbon1: TdxRibbon; // component
dxRibbonStatusBar1: TdxRibbonStatusBar; // component
dxBarManager1: TdxBarManager; // component
procedure FormCreate(Sender: TObject); // event onCreate
private
{ Private declarations }
public
{ Public declarations }
end;

var
fFRMBaseGeral: TfFRMBaseGeral;

implementation

{$R *.dfm}

uses uDMSuporte, uFNCgeral;

procedure TfFRMBaseGeral.FormCreate(Sender: TObject);
begin
DisableAero := True; //important for use the new layout of forms using DevExpress
//
if bCarregadoSkinLoadFromFile then //defined in "uFNCgeral.pas"
dxRibbon1.ColorSchemeName := sdxSkinsUserSkinName; //const with SkinName

{
As all forms are INHERITED from FRMBASEGERAL, so, all form will have the same appearance in basic components inherited!
}

end;

end.

--------------------------- My Forms Main = my Application Form ------------ AUTO-CREATE -----------------
unit uFRMMainExec;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
//
uFRMBaseGeral, {my Form parent - general for all another forms in project}
//
cxGraphics, cxControls, cxLookAndFeels,
//
cxLookAndFeelPainters, dxSkinsdxRibbonPainter, dxSkinsdxBarPainter, dxSkinsDefaultPainters, {Painters}
//
dxRibbonSkins, dxSkinsCore, , dxSkinMcSkin,
//
dxRibbonCustomizationForm, dxRibbonStatusBar, dxRibbon,
//
cxClasses, dxBar, dxStatusBar
//
;

type
TfFRMMainExec = class(TfFRMBaseGeral) //inherited class
procedure FormCreate(Sender: TObject); //event onCreate
private
{ Private declarations }
public
{ Public declarations }
end;

var
fFRMMainExec: TfFRMMainExec;

implementation

{$R *.dfm}

procedure TfFRMMainExec.FormCreate(Sender: TObject);
begin
inherited;
WindowState := wsMaximized; // definided in Desig as "Position = poScreenCenter" for all forms and only here as wsMaximized (why? anwser...)
end;

end.


------------------------------- MY GENERIC UNIT TO ALL MY FUNCTIONS -----------------------------------------------------

Code:
unit uFNCgeral;

interface // here definitions for "GLOBAL use" in my project, as PUBLIC definitions

//uses = not needs for while

procedure UsarSkinsNoAplicativo;

var
bCarregadoSkinLoadFromFile: Boolean = false;

implementation //LOCAL definitions of the implementation

uses
System.SysUtils, Vcl.Forms, {for use generic = procedures, functions, variables, consts, etc...}
//
uDMSuporte, {DataModule of Support}
//
dxSkinsDefaultPainters; {Painters}

procedure UsarSkinsNoAplicativo;
var
sCaminhoExecutavel : String; //path of my EXE
sSkinArquivo, sSkinNome: String; //Skin names (file and skin in use)
i1, i2 : Integer;
begin
{ sdxSkinsUserSkinName = variable with SkinName in use (in "dxSkinsDefaultPainters.pas")

dxSkinsUserSkinLoadFromFile('filexxxx.SKINRES') = boolean return

dxSkinController1.Refresh = force update components skinned, if needs}
// --------------------------------------------------------------------
//
try
sSkinArquivo := 'Pumpkin.skinres'; // my preference hehehe
sSkinNome := 'Pumpkin';
//
sCaminhoExecutavel := ExtractFilePath(Application.ExeName);
i1 := Length(sCaminhoExecutavel);
i2 := Pos('\EXE\', sCaminhoExecutavel);
Delete(sCaminhoExecutavel, i2, (i1 - i2)); //delete char not needs = '\EXE\' for to use 'SKN\' = my path of files .SKINRES
//
if FileExists(sCaminhoExecutavel + 'SKN\' + sSkinArquivo, false) then
bCarregadoSkinLoadFromFile := dxSkinsUserSkinLoadFromFile(sCaminhoExecutavel + 'SKN\' + sSkinArquivo, sSkinNome) {if not error = true}
else
DMSuporte.dxSkinController1.UseSkins := false; //if error, disable Skin use in application
finally

end;
end;

end.



********************************************************************************​********************************************
NOTE SPECIAL ABOUT HOW TO DO ONE FORM BASE (AS MY PROJECT)

1 - create 1 Form (as normally) with your attribute needs (as, Ribbom, BarManager, etc...)
2 - add in "Uses clausule INTERFACE the reference to unit "dxRibbonForm"
3 - change the CLASS original "TfFRMBaseGeral = class(TForm)" to "TfFRMBaseGeral = class(TdxRibbonForm)"
4 - now, create another form for be the "MAIN FORM" - this form should be INHERITED from "fFRMBASEGERAL"
5 - change in "PROJECT -> OPTION -> FORMS -> Main Form" the Form main for the new Form (in my case "FRMMainExec")
6 - I use, just, the DataModule and FormMain as AUTO-CREATE! The another Forms, will be "not-AUTO-CREATED"

NOTE: Only do changes in the FRMBaseGeral in ultimate case, because you can to promove errors in chain in the anothers Forms
********************************************************************************​********************************************


-------------------------------- TEXT FORM to my FORM
Code:
"FRMBaseGeral.DFM" -----------------------
object fFRMBaseGeral: TfFRMBaseGeral
Left = 0
Top = 0
BorderIcons = []
BorderStyle = bsDialog
Caption = 'fFRMBaseGeral'
ClientHeight = 444
ClientWidth = 750
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
ShowHint = True
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object dxRibbon1: TdxRibbon
Left = 0
Top = 0
Width = 750
Height = 27
ApplicationButton.Visible = False
BarManager = dxBarManager1
ColorSchemeName = 'Blue'
EnableTabAero = False
QuickAccessToolbar.Visible = False
ShowMinimizeButton = False
ShowTabGroups = False
SupportNonClientDrawing = True
Contexts = <>
TabOrder = 0
TabStop = False
end
object dxRibbonStatusBar1: TdxRibbonStatusBar
Left = 0
Top = 421
Width = 750
Height = 23
Panels = <>
Ribbon = dxRibbon1
Font.Charset = DEFAULT_CHARSET
Font.Color = clDefault
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
end
object dxBarManager1: TdxBarManager
AllowReset = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
CanCustomize = False
Categories.Strings = (
'Default')
Categories.ItemsVisibles = (
2)
Categories.Visibles = (
True)
PopupMenuLinks = <>
ShowFullMenusAfterDelay = False
UseF10ForMenu = False
UseSystemFont = True
Left = 48
Top = 136
DockControlHeights = (
0
0
0
0)
end
end



---------------------- create by: File -> New -> Other -> Inheritable Items -> choice fFRMBaseGeral --------------------------
inherited fFRMMainExec: TfFRMMainExec
BorderIcons = [biSystemMenu, biMinimize, biMaximize]
BorderStyle = bsSizeable
Caption = 'fFRMMainExec'
ClientHeight = 445
ClientWidth = 729
ExplicitWidth = 745
ExplicitHeight = 484
PixelsPerInch = 96
TextHeight = 13
inherited dxRibbon1: TdxRibbon
Width = 729
ExplicitWidth = 729
end
inherited dxRibbonStatusBar1: TdxRibbonStatusBar
Top = 422
Width = 729
ExplicitTop = 422
ExplicitWidth = 729
end
inherited dxBarManager1: TdxBarManager
Left = 424
Top = 112
DockControlHeights = (
0
0
0
0)
end
end


-------------------------------------------
object DMSuporte: TDMSuporte
OldCreateOrder = False
OnCreate = DataModuleCreate
Height = 473
Width = 744
object dxSkinController1: TdxSkinController
SkinName = 'UserSkin'
Left = 56
Top = 16
end
end

PirateBay Manager Delphi Source

SMTP Client Sample

$
0
0
Simple example of a project developed in Delphi XE7 for e-mail sending using the SMTP Client's lib Indy.
I hope you can help those in need.

.zip  SMTP Simples.zip (Size: 813.04 KB / Downloads: 21)

Perfect Age Anti Wrinkle Cream

$
0
0
Shallot deal from captains imperial era think Icannot and he re- flower that one in the yeah like packaging is my favorites like shave gels weight spr nah it's liquid then that finds out and I just love it sent is beautiful I love all the  fans in the Bellesse range here regularly on salefor less than three that's normally around five dollars they might showers just an absolutely wonderful time I love these find this on tonight knows I few picas from the drugstore would be the Sally Hansen miracle cure use this as a base coat it does I really nice job I think it helps my nails st strong and then I'm also using I had a taco as well but really like that one Sally Hansen and my choice of nail polish from the truck still would be from bourgeois.

http://eyebornfacts.org/bellesse/

DelphiFan.FMX Dialog Unit

$
0
0
This thread is for FMX only units for use to anyone on the forum. Novices as well as old-timers can chip in or not. Any additions/modifications/deletions to any existing units on the thread I'll update this first post to include those changes and/or new units. Only one criteria should be in order and can change as time (or the moderators allow) and this should be:

Only use the full namespace naming convention for units and the its use in the code. The reasoning behind this is so there will be no possible conflict between any possible units that may be in a project.

For example:
- All unit names should start with DelphFan and break out from there. Like the first unit I'm submitting is DelphiFan.FMX.CustomDialogs.
- Inside of each procedure/function a procedure/function call should have the full namespace included. Like System.SysUtils.Trim() instead of just Trim()
- Same goes for any types being used. Like System.UITypes.TMsgDlgBtn.mbOK instead of just mbOK.

So to start off something simple and basic:
DelphFan.FMX.CustomDialogs

Code:
unit DelphiFan.FMX.CustomDialogs;

{ -==
  The purpose of this unit is to be a placeholder for constantly used
  simple dialogs without having to constantly retype the same things over
  and over again.

  Due to the use of namespaces this unit should not conflict with any other unit
  ==-}

interface

uses
  System.SysUtils,
  System.UITypes,
  FMX.Dialogs,
  FMX.Forms;

  function CustomDialog(
        const aMsg : String = '';
        const aDlgType : System.UITypes.TMsgDlgType = System.UITypes.TMsgDlgType.mtCustom;
        const aButtons : System.UITypes.TMsgDlgButtons = [System.UITypes.TMsgDlgBtn.mbOK];
        const aDefaultButton : System.UITypes.TMsgDlgBtn = System.UITypes.TMsgDlgBtn.mbOK
        ) : System.UITypes.TModalResult;

  procedure FatalErrorDlg(const aCustomMsg : String = '');

  procedure InfoDlg(const aCustomMsg : String = '');

  procedure NotAllowedDlg(const aCustomMsg : String = '');

  function OkToExitDlg(const aCustomMsg : String = '') : Boolean;

  function YesNoDlg(const aCustomMsg : String = '') : Integer;
  function YesNoCancelDlg(const aCustomMsg : String = '') : Integer;

implementation

function CustomDialog(
      const aMsg : String = '';
      const aDlgType : System.UITypes.TMsgDlgType = System.UITypes.TMsgDlgType.mtCustom;
      const aButtons : System.UITypes.TMsgDlgButtons = [System.UITypes.TMsgDlgBtn.mbOK];
      const aDefaultButton : System.UITypes.TMsgDlgBtn = System.UITypes.TMsgDlgBtn.mbOK
      ) : System.UITypes.TModalResult; overload;
var
  frmDialog : TForm;
begin
  frmDialog := FMX.Dialogs.CreateMessageDialog(aMsg, aDlgType, aButtons, aDefaultButton);
  try
    frmDialog.ShowModal;
    Result := frmDialog.ModalResult;
  finally
    System.SysUtils.FreeAndNil(frmDialog);
  end;
end;

procedure FatalErrorDlg(const aCustomMsg : String = '');
var
  sTmp : String;
begin
  // set a default in case a msg wasn't passed
  sTmp := 'Fatal Error';
  if System.SysUtils.Trim(aCustomMsg) <> '' then
    sTmp := aCustomMsg;

  DelphiFan.FMX.CustomDialogs.CustomDialog(sTmp,
               System.UITypes.TMsgDlgType.mtError,
               [System.UITypes.TMsgDlgBtn.mbOK],
               System.UITypes.TMsgDlgBtn.mbOK
               );
end;


procedure InfoDlg(const aCustomMsg : String = '');
begin
  DelphiFan.FMX.CustomDialogs.CustomDialog(aCustomMsg,
               System.UITypes.TMsgDlgType.mtInformation,
               [System.UITypes.TMsgDlgBtn.mbOK],
               System.UITypes.TMsgDlgBtn.mbOK
               );
end;

procedure NotAllowedDlg(const aCustomMsg : String = '');
var
  sTmp : String;
begin
  // set a default in case a msg wasn't passed
  sTmp := 'Action Not Allowed.';
  if System.SysUtils.Trim(aCustomMsg) <> '' then
    sTmp := aCustomMsg;

  DelphiFan.FMX.CustomDialogs.CustomDialog(sTmp, System.UITypes.TMsgDlgType.mtWarning, [System.UITypes.TMsgDlgBtn.mbOK], System.UITypes.TMsgDlgBtn.mbOK);
end;

function OkToExitDlg(const aCustomMsg  : String = '') : Boolean;
var
  sMsg : String;
begin
  // set a default in case a msg wasn't passed
  sMsg := 'Are you sure you wish to exit?';
  if System.SysUtils.Trim(aCustomMsg) <> '' then
    sMsg := aCustomMsg;

  Result := (DelphiFan.FMX.CustomDialogs.YesNoCancelDlg(sMsg) = mrYes);
end;

function YesNoDlg(const aCustomMsg : String = '') : Integer;
begin
  Result := DelphiFan.FMX.CustomDialogs.CustomDialog(aCustomMsg,
                         System.UITypes.TMsgDlgType.mtConfirmation,
                         mbYesNo,
                         System.UITypes.TMsgDlgBtn.mbNo
                         );
end;

function YesNoCancelDlg(const aCustomMsg : String = '') : Integer;
begin
  Result := DelphiFan.FMX.CustomDialogs.CustomDialog(aCustomMsg,
                         System.UITypes.TMsgDlgType.mtConfirmation,
                         FMX.Dialogs.mbYesNoCancel,
                         System.UITypes.TMsgDlgBtn.mbNo
                         );
end;

end.

46 Useful Utility Functions For #Delphi XE8

$
0
0
Code:
function GetCaseSensitiveFileName(const FileName: string; RootPath: string = ”): string;

function isPathCanUseNow(const PathOrDir: string; const Default: Boolean = True): Boolean;

function GetSDCardPath(Index: Integer = 0): string;

function FindSDCardSubPath(SubPath: string; Index: Integer = 0): string;
function GetAppPath: string;
function BuildFileListInAPath(const Path: string; const Attr: Integer; const List: TStrings;
JustFile: Boolean = False): Boolean; overload;

function BuildFileListInAPath(const Path: string; const Attr: Integer;
JustFile: Boolean = False): string; overload;

function GetFileNamesFromDirectory(const DirName: string; const SearchFilter: string = ‘*';
const FileAttribs: Integer = faAnyFile; const isIncludeSubDirName: Boolean = False; const Recursion: Boolean = False;
const FullName: Boolean = False): string;

function DeleteDirectoryByEcho(const Source: string;
AbortOnFailure: Boolean = False; YesToAll: Boolean = True;
WaitMinSecond: Integer = DeleteDirectories_WaitMinSecond): Boolean;
function GetTotalSpaceSize(Path: string = PathDelim): UInt64;
function GetAvailableSpaceSize(Path: string = PathDelim): UInt64;
function GetFreeSpaceSize(Path: string = PathDelim): UInt64;

function GetTotalMemorySize: UInt64;
function GetFreeMemorySize: UInt64;
function IsPadOrPC(MiniScreenInches: Single = 6.2): Boolean;

function GetVolumePaths: string;

function GetExternalStoragePath: string;
function GetExterStoragePath: string;
function GetInnerStoragePath: string;
function GetIsExternalStorageRemovable: Boolean;
function FindJavaClass(NamePath: string): Boolean;
function FindJavaMethod(MethodName, Signature: string; CalssNamePath: string = ”): Boolean;
function FindJavaStaticMethod(MethodName, Signature: string; CalssNamePath: string = ”): Boolean;



Here are the string utility functions:

function DetectUTF8Encoding(const s: TBytes): TEncodeType;
function HasExtendCharacter(const s: TBytes): Boolean;
function HasUTF8BOM(S : TStream) : boolean; overload;
function HasUTF8BOM(const S: TBytes) : boolean; overload;
function HasUTF8BOM(const S: MarshaledAString) : boolean; overload;

function BytesAutoToString(const S: TBytes; const UnknowEncodeDefaultIsAnsi: Boolean = True): string; overload;
function BytesAutoToString(const S: MarshaledAString; const UnknowEncodeDefaultIsAnsi: Boolean = True): string; overload;
function StreamAutoToString(const aStream: TStream; const UnknowEncodeDefaultIsAnsi: Boolean = True): string;

function IsUTF8String(const s: MarshaledAString): Boolean; overload;
function IsUTF8String(const s: TBytes): Boolean; overload;



Here are the Firemonkey screen functions:

function GetScreenPixelsXY(const Context: TFmxObject = nil): TPoint;

function GetScreenClientPixelsXY(const Context: TFmxObject = nil): TPoint;

function GetScreenInchXY(const Context: TFmxObject = nil): TPointF;
function GetScreenDPIXY(const Context: TFmxObject = nil): TPointF;

function GetScreenDPI(const Context: TFmxObject = nil): Single;
function GetScreenInches(const Context: TFmxObject = nil): Single;
function GetFormXY(const AForm: TCustomForm): TPointF;
function GetFormClientXY(const AForm: TCustomForm): TPointF;
function GetFormClient(const AForm: TCustomForm): TRectF;
function GetFormPixelsXY(const AForm: TCustomForm): TPointF;
function GetFormClientPixelsXY(const AForm: TCustomForm): TPointF;



And here are the message dialog functions:

procedure ShowMessageWait(const AMessage: string);
procedure ShowMessageFmtWait(const AMessage: string; const AParams: array of const);
procedure ShowMessagePosWait(const AMessage: string; const AX, AY: Integer);

Example FaceSDK with serial

TXLSFile,NativeExcel and XLSReadWriteII comparation

$
0
0
TXLSFile: Write 65535 rows each 10 cols,time taken: 00:17.796
NativeExcel: Write 65535 rows each 10 cols,time taken: 00:01.439
XLSReadWriteII: Write 65535 rows each 10 cols,time taken: 00:02.600

TXLSFile: Read 65535 rows each 10 cols,time taken: 00:02.261
NativeExcel: Read 65535 rows each 10 cols,time taken: 00:03.204
XLSReadWriteII: Read 65535 rows each 10 cols,time taken: 00:01.447

TXLSFile: Write 2000 rows each 100 cols,time taken: 00:01.738
NativeExcel: Write 2000 rows each 100 cols,time taken: 00:00.328
XLSReadWriteII: Write 2000 rows each 100 cols,time taken: 00:00.565

TXLSFile: Read 2000 rows each 100 cols,time taken: 00:00.571
NativeExcel: Read 2000 rows each 100 cols,time taken: 00:00.955
XLSReadWriteII: Read 2000 rows each 100 cols,time taken: 00:00.448


TXLSFile: Write 65535 rows each 100 cols,time taken: 30:18.314
NativeExcel: Write 65535 rows each 100 cols,time taken: 00:12.144
XLSReadWriteII: Write 65535 rows each 100 cols,time taken: 00:40.625


TXLSFile: Read 65535 rows each 100 cols,time taken: 01:22.480
NativeExcel: Read 65535 rows each 100 cols, Error:Out of memory
XLSReadWriteII: Read 65535 rows each 100 cols,time taken: 00:10.854

Xe8 Demos and tutorial Full Download

Delphi XE8 update 1 crack

$
0
0
Delphi XE8 update 1 crack:

Someone have any notice???

Thanks a lot!

KbmMW V4 Help Document (Chm)

JNI Wrapper for Delphi and FreePascal

$
0
0
This JNI Wrapper for Delphi and FreePascal provides a powerful and simplified object-oriented API for doing mixed language programming in Java and Delphi (Object Pascal language) or FreePascal. This may provide an easier and more productive way of getting Win32 and Win64 features in Java projects and integrating legacy code (at least for the Delphi or FreePascal community). Please read the readme file inside the zip file to learn more.

I have noticed that JNIWapper for Delphi and FreePascal was not supporting returning of String and Arrays types from Java, so i have implemented that and i have now enhanced JNI Wrapper to be very powerful , so it's now supporting all the necessary functions and methods and  and much more... hope you will happy with it cause i have worked hard to bring this new 2.82 to you, it is really now a professional software of a good quality.

Also i have enhanced more JNI Wrapper and ported it to 64 bit and to both FreePascal and the Delphi XE versions, here is the functions that i have implemented and added:

function JstringArrayToDTStrings(jarr : JArray) : TStrings;
function JdoubleArrayToDdoubleArray(jarr : JdoubleArray) : TDdoubleArray;
function JfloatArrayToDsingleArray(jarr : JFloatArray) : TDsingleArray;
function JcharArrayToDwordArray(jarr : JCharArray) : TDwordArray;
function JbyteArrayToDshortintArray(jarr : JByteArray) : TDshortintArray;
function JshortArrayToDsmallintArray(jarr : JShortArray) : TDsmallintArray;
function JbooleanArrayToDbooleanArray(jarr : JBooleanArray) : TDbooleanArray;

And don't forget to call TJavaVM.freeRef() method from Delphi or FreePascal when you need to garbage collect and free the memory that was allocated.

For: FPC Pascal v2.2.0+ / Delphi XE+

Download You can't view the links! Click here to register

Cheers,

Peter

Android to PC USB Interfaces (ADB, AOA, HID) with Delphi

$
0
0
his is a set of code to aid development for communication between an Android device and 
an Embedded Device, or PC. There are examples for the following:

Communication between PC and Android device, over USB, using the ADB (Android Debug) protocol.
Communication between PC and Android device, over USB, using the AOA (Android Open Accessory) protocol.
Communication between PC and a simple HID device (Arduino and LPC 1768 Microcontroller).

All PC code is written in Delphi.
Android code is in Java and the embedded code in C/C++.

So why would you want this?
We are developing a hardware device which needs to interact with an Android phone.
It needs to be robust and simple, so we opted for a USB interface. 
(Wireless connections were ruled out)
In this case the Android device is the USB client, and the hardware device is USB Host.
In development it became clear that it would be handy to change the hardware device for a PC,
to test the Android side of things without to much hassle on the hardware device.
Therefor we needed an Android <-> PC bridge.
I found a few (in C), but I opted to use Delphi for quick testing. 
Based on LibUSBK there is a class which implements a simple twoway USB connection.
From there, there are classes which implement the ADB protocol and the AOA protocol.

As you may know the ADB interface runs on devices supporting Android 1.5. AOA is only supported
by some devices, and need Android 2.3.3.
Personally, I don't see any advantage of using AOA as it is not widely supported. In fact, 
I was only able to get this working with one Android Device i have (a chines Android TV Stick)

All of this code becomes 'obsolete' when using an Android device which adds HID facility. 
This is supported from Android 4.0. Since all the basics wre there I decide to add an example where 
Delphi takes over the Android side to test the hardware. 
I have added two examples on Embedded platforms, for Arduino and LPC 1768 (from mBed).
I have also some examples for FEZ Domino or Microchip Cereboth (both implementing ADB host).
On the HID facility: This is also only implemented in some devices.

DLNA DMC (Digital Media Controller) class for Delphi

$
0
0
TUpnpDMC is a class that implements a DLNA DMC (Digital Media Controller) in Delphi.
I needed some Delphi code to play Videos from my server to my SAMSUNG TV.
I could only find some partial implementation, one in Visual Basic and some code in Delphi, 
bur not a complete DMC, so I wrote this.
There is an example application in the directory UPNPDelphi.
On second thought, I should heva named the class TDLNADMC and the same for the example.
For now, I am just sharing this code.

You can browse the available servers and renderers on your system.
Once found, you can select an item from the server and play it on a renderer.
Then you can pause, stop, play, seek that item

You create a TUpnpDMC object by calling _create_, 
supplying an owner and a TStrings (not NIL) used as Log
You can search devices by _SearchDevices_
Set _OnDeviceListChanged_ to receive notifaction on Devices available
Then retrieve Servers and Renderers by inpecting _ServerCount_ and _GetServerName_ etc.
Select a Server with _SetServerIndex_, the same for a Renderer
Browse the Server tree with _BrowseRoot_ and subdirectories with _BrowseIndex_,
go back with _Back_
Inspect items with _GetItemName_ and _ItemCount_
Select an item with _SetItemIndex_

Now you can Play, Pause, Seek, SetPosition etc the item with the corresponding methods.
You can retrieve information bij GetPosition and GetPlayStatus

Running another app in Firemonkey android

$
0
0
Code:
Uses
  Androidapi.Helpers, AndroidApi.JNI.GraphicsContentViewText;

procedure TForm1.Button1Click(Sender: TObject);
var
intent: JIntent;
begin
  intent := TJIntent.Create;
  intent := SharedActivityContext.getPackageManager.getLaunchIntentForPackage
              (StringToJString('com.kakao.talk')) ;
  if Assigned (intent) then
     SharedActivity.startActivity(intent);
end;

'com.kakao.talk' is a package name of another app.

Send WinRT API Notifications In XE8 to Win10

$
0
0
Developer Marco Cantu from Embarcadero released a VCL example for sending Windows 10 notifications with Delphi XE8. I have converted this example over to Firemonkey. Apparently Windows 10 has a notification system vary similar to the notification system in Android and IOS. The first thing you need to get this example working is to install the WinRT API by clicking Tools|GetIt Package Manager in the Delphi XE8 IDE. I did have to make a few changes to the code for it to compile under FMX. These were converting Application.Handle to FmxHandleToHWND(Form1.Handle), converting Application.ExeName to ParamStr(0), and adding Winapi.Windows to the units section for MAX_PATH. I don’t have a Windows 10 machine so you’ll have to compile it and see if it works for you. Under Windows 8.1 it compiles and runs without errors. You should also be able to use this code with Appmethod.

Patch Instructions for DevExpress VCL 15.1.4 (D2010-DXE8)

$
0
0
Files:
1. Library\RSxx\dxCoreRSxx.bpl 
2. Library\RSxx\Win64\dxCoreRSxx.bpl 

Patterns:
1. Search for FF FF 85 C0 75 0C E8 and replace 75 with EB 
2. Search for UNICODE string trial version and replace with empty string:
t.r.i.a.l. .v.e.r.s.i.o.n
 . . . . . . . . . . . . 
Registry:
Under HKEY_CLASSES_ROOT\Licenses\8D9156A0-813A-4375-AB5E-32A8F2AB039E delete entry 151

Upgrade Your Projects To D10

$
0
0
If you are upgrading your projects from previous versions of Delphi Firemonkey like XE5, XE6, XE7, and XE8 to Firemonkey in Delphi 10 Seattle here are some tips and tricks which may help you. There are less refactoring changes in the FMX RTL between XE8 and Seattle as far as I’ve seen so upgrading should go pretty smoothly. These tips cover upgrading older projects so that they compile and run on the latest version and patching some components which may not be available yet for the latest version.

Upgrading XE5, XE6, and XE7 Projects

If you are upgrading a project from XE5, XE6, or XE7 to Delphi 10 Seattle what you may want to do is create a new project file instead and then click Project|Add To Project in the IDE. Add all of the old forms and units from your previous project to the new Delphi Seattle project. The reason for this is that XE8 introduced new mobile platforms and some older projects may not load correctly. Once you create the new project and add the original units it should work okay.

Upgrading Android Projects

If you are upgrading an XE5, XE6, XE7, or XE8 project which you have deployed to Android in the past you will want to delete any existing AndroidManifest.template.xml files that may be hanging around. The older Android manifest file will cause problems in the latest version (when you rotate the device the app will close). By deleting the old file a new file will automatically get created to replace it. If you modified your AndroidManifest.template.xml by adding an Android service, a custom DEX file, or push notifications you will need to add those modifications to the new AndroidManifest.template.xml file as well. Be aware that when you create a new project and have not yet saved it anywhere it will exist in My Documents\Embarcadero\Studio\Projects\ and there is a AndroidManifest.template.xml file there which should be deleted as well.

Upgrading Projects Using IJavaInterface

The IJavaInterface definition was removed from the RTL. If you have a project or component that uses it you will need to find a workaround. One project that uses it is the AerServ library. If you do encounter this error in AerServCommon.Android.pas one thing you can do is paste this code at the top of the file:

Delphi/Pascal

const
IID_IJavaInterface_Name = ‘{024CE73D-3FF3-423B-B8B1-DCE9DAC254C6}’;
IID_IJavaInterface: TGUID = IID_IJavaInterface_Name;
type
IJavaInterface = interface(IJava)
[IID_IJavaInterface_Name]
end;


The AerServ library for Android should compile at this point. I have not tested any other compatibility issues with it so use at your own risk. There may also be a replacement for IJavaInterface that I am not aware of.

Upgrading PaxCompiler v4.2

If you are using paxCompiler v4.2 and would like to compile it in Delphi 10 Seattle you can paste this near the bottom of PaxCompiler.def (above the {$IFNDEF VARIANTS}{$DEFINE MSWINDOWS}{$ENDIF} section):

Delphi/Pascal

{$ifdef Ver300}
{$define VARIANTS}
{$define UNIC}
{$define DRTTI}
{$define DPULSAR}
{$define DXE7}
{$define GE_DXE2}
{$define GE_DXE3}
{$define GE_DXE4}
{$define GE_DXE5}
{$define GE_DXE6}
{$define GE_DXE7}
{$define GE_DXE8}
{$IFDEF CPUX64}
{$DEFINE PAX64}
{$ENDIF}
{$endif}
Upgrading TListView

TListView has been refactored in Delphi 10 Seattle. If you use any of it’s events which utilize TListViewItem you will need to add two additional includes into your unit. The two new units are FMX.ListView.Appearances and FMX.ListView.Adapters.Base. Alternately, you can delete the FMX.ListView and FMX.ListView.Types units from the Uses clause and it will automatically re-include all the needed units. If you previously used the TListView.Selected property you will need to change it to something like this instead ListView1.Items[ListView1.Selected.Index].

Upgrading AppTethering Projects

The way AppTethering works in Seattle has changed from XE8. The events for sending and receiving data are different so you may have to rework your code in those events completely to get it working again. There are AppTethering demos you can look at to see how the new events work. You can also review the AppTethering documentation. Be aware that AppTethering is not compatible between versions. XE7 AppTethering can not talk to XE8 AppTethering or to Delphi 10 AppTethering.

Manually Upgrading Third Party Delphi XE8 Components

If you are using some third party components or code and you can’t wait for the vendor to upgrade them you can always try patching them yourself. The main thing you can look for is code that uses {$ifdef Ver290}. That signifies a section of code that will run if it is compiled in Delphi XE8. You can duplicate that section and change the new piece of code to {$ifdef Ver300} which signifies Delphi 10 Seattle. In the PaxCompiler example above you can see where I did just that. Obviously this does not take into account any architecture changes in Delphi but may get you a head start in upgrading your projects that use third party components.

Utilizing Delphi Components In AppMethod

If you are using AppMethod and you would like to use some components which are for Delphi but do not mention Appmethod chances are they will just work. However, if you receive any error where it stops on you a Unit called VCL or something similar in it’s package file you should be able to remove this unit and the component should still compile. The component may not have full functionality at design time if there are any property editors but otherwise it should have full functionality.

Upgrading Android Services

If you rolled your own Android service capability with a previous version of Firemonkey you can now use the built in Android service functionality. You can read a tutorial for creating an Android service in Delphi 10 here.

Upgrading a VCL Project To FMX

Lastly if you have a VCL project and you would like to convert it to Firemonkey (and possibly mobile) there is always the Mida Converter utility. It will even convert and utilize some third party components. Read our coverage of Mida Converter.

[REQ] delphi one db connection to multiple exe

$
0
0
Hi All,
I nedd to say if it's possibile make a single connection dbpool to firebird  database from IBDAC . I have a big application migrated from DF use (!!!) and the simplest method I used was to split the app in to multiiple module exe, but everyone with its dbconnection. May be it's possibile to create a single app connectred to dbpool ? Could anyone help me with some source code ?
Thanks for help
 

RS 10 Seattle - Fix large fonts in dialogs (Update for solution)

$
0
0
An example for such a dialog is the Evaluate/Modify dialog.

Fix:

Change this in LargeFontFixRegisterUnit.pas :
- Application.OnModalBegin ==> Screen.OnActiveFormChange
And some code cosmetics :
- HookOnModalBegin ==> HookOnActiveFormChange
- FSavedApplOnModalBegin ==> FSavedOnActiveFormChange
Viewing all 173 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>