Jump to content

Search the Community

Showing results for tags 'fmx'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 125 results

  1. ertank

    Simple app for Android 5.0.2

    Hello, I am using Delphi 10.4.2. There is a very simple app (needs internet and network status permissions, 3 pages total) that I need to run on Android 5.0.2. I compiled it with stock SDK 25.2.5 targeting Android32. When package tried to be loaded on Android 5.0.2 it says Compiler error There is a problem with the packet parsing. Docwiki says Delphi 10.4.2 supports Android 6 minimum. Even Delphi 10.3.3 supports Android 5.2 mimimum. I wonder if there is some "workaround" that I can use without installing an older version. Thanks & Regards, Ertan
  2. Bob Baudewyns

    How to design QR Scan focus screen with FMX

    Hi, I'm developing an application that needs to scan QR Code. For the GUI design, I'd like to provide the usual scan focus screen with a transparent square inside a rectangle (the screen) like the attached mock-up. I already tried different approaches but not very successful. Any idea how could I design this with FMX ? Thanks
  3. IconFontsImageList components by @Carlo Barazzetta could be the answer: you can explorer the complete wiki to see how it works. Summary of library: An IconFontsImageCollection component that inherits from Delphi's CustomImageCollection and is compatible with VirtualImageList A IconFontsVirtualImageList, to use with Delphi version older than 10.3 A rendering engine of Icon-fonts using GDI+ (from Delphi XE4) A complete backward compatibility with older Delphi versions (from Delphi 7) A useful Collection and Component editor, with support for Category of Icons A custom CharMap viewer, to easily select icons contained in any Font Support for changing the Color based on the active VCL Style. High performance of drawing engine Support for FMX (also for mobile platforms) It's free and open-source Icons based on Fonts are a good alternative to bitmaps because they need only the Font installed in the system to obtain thousands of images (like the "Material Design Font Desktop.ttf" font: https://github.com/Templarian/MaterialDesign-Font). The icons scales perfectly, so, you don't need to multiple resolutions of your images to match the DPI of the monitors and multiple colors for Theme used. The Collection of Icons can be rendered by a single Font/Color defined at collection level, or by different Fonts/Color defined at Icon level, so you can mix different icons from different Fonts in a single collection. The library is quite stable, but any contribution is welcome!
  4. Hi, I need examples for error handling strategies. Does anyone have any advice? (Log every success and failed procedure or function.)
  5. hi, Problem.: 1.- ListView using with DynamiAppearance, using only these kinds of objects.: 2.- I have to create a progress bar in runtime. I want to create/draw a bitmap in runtime. 3.- How to draw a rectangle, and fill it with color. -input data.: 25 -output.: Some bitmap with two rectangle -bitmap Height 10 Width 100 all the time! kind regards kz.
  6. Hi I am trying to split an Image stored in a first TImageList into a second TImageList all my attempts to access a multiresbitmap contained in a TImagelist show an error on program exit TImageListHelper = class helper for TImageList function Add(aBitmap: TBitmap): integer; end; var Form18: TForm18; implementation {$R *.fmx} uses FMX.MultiResBitmap; procedure TForm18.Button1Click(Sender: TObject); var sbitmap, pBitmap: TBitmap; vSource: TCustomSourceItem; vBitmapItem: TCustomBitmapItem; vDest: TCustomDestinationItem; begin Images.ClearCache; Images.BeginUpdate; if Images.Destination.Count > 0 then Images.Destination.Clear; vSource := ImageList1.Source.Items[1]; vBitmapItem := vSource.MultiResBitmap.ItemByScale(1, True, True); sbitmap := vBitmapItem.Bitmap; pBitmap := TBitmap.Create(100, 100); try for var l := 0 to 3 do for var c := 0 to 3 do begin var r: TRect := TRect.Create(pBitmap.Width * c, pBitmap.Height * l, pBitmap.Width * c + pBitmap.Width, pBitmap.Height * l + pBitmap.Height); pBitmap.CopyFromBitmap(sbitmap, r, 0, 0); Images.Add(pBitmap); end; finally pBitmap := nil; // if not an EAccessViolation exception raised when program close pBitmap.Free; end; Images.EndUpdate; end; { TImageListHelper } function TImageListHelper.Add(aBitmap: TBitmap): integer; const SCALE = 1; var vSource: TCustomSourceItem; vBitmapItem: TCustomBitmapItem; vDest: TCustomDestinationItem; vLayer: TLayer; begin result := -1; if (aBitmap.Width = 0) or (aBitmap.Height = 0) then exit; // add source bitmap vSource := Source.Add; vSource.MultiResBitmap.TransparentColor := TColorRec.Fuchsia; vSource.MultiResBitmap.SizeKind := TSizeKind.Source; vSource.MultiResBitmap.Width := Round(aBitmap.Width / SCALE); vSource.MultiResBitmap.Height := Round(aBitmap.Height / SCALE); vBitmapItem := vSource.MultiResBitmap.ItemByScale(SCALE, True, True); if vBitmapItem = nil then begin vBitmapItem := vSource.MultiResBitmap.Add; vBitmapItem.SCALE := SCALE; end; vBitmapItem.Bitmap.Assign(aBitmap); vDest := Destination.Add; vLayer := vDest.Layers.Add; vLayer.SourceRect.Rect := TRectF.Create(TPoint.Zero, vSource.MultiResBitmap.Width, vSource.MultiResBitmap.Height); vLayer.Name := vSource.Name; result := vDest.Index; end; AccessViolation if pbitmap:=nil is omitted >>EAccessViolation exception in module taKinFMX.exe in 00008338 >>Violation of access to the address 00408338 in the module 'taKinFMX.exe'. Reading of the address FFFFFFFC. ... >> The instruction at 0x0000000000408338 uses the memory address 0x00000000FFFFFFFC. Memory state cannot be read. and cause Unexpected Memory Leaks An unexpected memory leak has occurred. The unexpected small block leaks are: 29 - 36 bytes: TD2DBitmapHandle x 1, TBitmapImage x 1 45 - 52 bytes: TBitmap x 1 61 - 68 bytes: Unknown x 1 Where does I go wrong ? Is there another way to split (like during design time) an image ?
  7. hi every one can some one help me with problem I'm using Delphi REST with server and client but when i tried to show data on the client side its show only one row for some reason, what did i do wrong ? PS : I'm using Delphi roi and restdataware the video down show what I'm deal with ; any help will be very appreciated ^^ thank you on the client side i'm using this code procedure listv; var jsonObj : TJsonObject; json, sucesso, erro,id_store ,nom_store, phone_saler: string; begin // FrmLogin.FloatAnimation2.Stop; // FrmLogin.FloatAnimation3.Stop; if FrmLogin.listvreq.Response.JSONValue = nil then begin // FrmLogin.ExibirCampos; ShowMessage('خطأ في إنشاء الحساب (JSON غير صالح)'); exit; end; try json := FrmLogin.listvreq.Response.JSONValue.ToString; jsonObj := TJSONObject.ParseJSONValue(TEncoding.UTF8.GetBytes(json), 0) as TJSONObject; sucesso := jsonObj.GetValue('sucesso').Value; erro := jsonObj.GetValue('erro').Value; id_store := jsonObj.GetValue('id_store').Value; nom_store := jsonObj.GetValue('nom_store').Value; if sucesso <> 'S' then begin // FrmLogin.ExibirCampos; ShowMessage(erro); exit; end else // showmessage('تم احضار بيانات: ' + id_store+nom_store); // FrmLogin.ExibirCampos;/// // FrmLogin.ListView1.Items.Clear(); finally jsonObj.DisposeOf; end; end; procedure listverr(Sender: TObject); begin if Assigned(Sender) and (Sender is Exception) then begin // FrmLogin.ExibirCampos; showmessage(Exception(Sender).Message); end; end; procedure TFrmLogin.StartLogin2; begin TThread.CreateAnonymousThread( procedure var Success: Boolean; begin try RequestLogin.Execute; Success := RequestLogin.Response.Status.Success; except Success := False; end; TThread.Queue(nil, procedure begin AfterLogin2(Success); end ); end ).Start; end; procedure TFrmLogin.AfterLogin2(Success: Boolean); begin if Success then begin listvreq.Params.Clear; listvreq.AddParameter('type_store',ComboBox1.Selected.Text); /// **** listvreq.ExecuteAsync(listv, true, true, listverr); end else begin showmessage (' عفوا ...! لايمكن الاتصال بالخادم حاليا يرجى المحاولة لاحقا') end; on server side : procedure Tdm.DWEventsEventslistvReplyEvent(var Params: TDWParams; var Result: string); var type_store, erro : string; usuario : TUsuario; json : TJsonObject; begin try sleep(4000); type_store := Params.ItemsString['type_store'].AsString; json := TJsonObject.Create; usuario := TUsuario.Create(dm.conn); usuario.type_store := type_store; if NOT usuario.listv(erro) then begin //{"sucesso": "N", "erro":"Usuلrio nمo informado", "codusuario":"0"} json.AddPair('sucesso', 'N'); json.AddPair('erro', erro); json.AddPair('id_store', ''); json.AddPair('nom_store', ''); end else begin json.AddPair('sucesso', 'S'); json.AddPair('erro', ''); json.AddPair('id_store', usuario.id_store.ToString); json.AddPair('nom_store', usuario.nom_store); end; Result := json.ToString; finally json.DisposeOf; usuario.DisposeOf; end; and in class i add called unit usuario function TUsuario.listv(out erro: string): Boolean; var qry : TFDQuery; begin try qry := TFDQuery.Create(nil); qry.Connection := FConn; with qry do begin Active := false; SQL.Clear; SQL.Add('SELECT * from saler WHERE type_store = :any '); ParamByName('any').Value := type_store; Active := true; if RecordCount > 0 then begin id_store := FieldByName('id_store').AsInteger; nom_store := FieldByName('nom_store').AsString; erro := ''; Result := true; end else begin // id_store := 0; erro := 'تعذر جلب بيانات المعلنين'; Result := false; end; DisposeOf; end; except on ex:exception do begin erro := 'خطأ في التحقق من صحة تسجيل الدخول: ' + ex.Message; Result := false; end; end; bandicam_2021-05-01_17-50-29-913.mp4
  8. This issue shows up when writing a Characteristic from the Andorid app to the BT device. Here is the sequence using these TBluetoothGattCharactertistics methods SetValueAsUint32, then 4 bytes are transmitted. SetValueAsUint64, then 8 bytes are transmitted SetValueAsUint32, then 8 bytes are transmitted, the first four bytes contain the new 32 bits and the remaining 4 bytes contain the previous 64 bit value ************************************************************************************************************* In System.Bluetooth we find this method @line 2717(10.4.2), which all of the above methods call procedure TBluetoothGattCharacteristic.SetValueAs<T>(AValue: T; Offset: Integer); var LBytes: TBytes; begin LBytes := Value; if (Length(LBytes) < Offset + SizeOf(AValue)) then SetLength(LBytes, Offset + SizeOf(AValue)); Move(AValue, LBytes[Offset], SizeOf(AValue)); SetValue(LBytes); end; LBytes is always the last value sent (64 bits or 8bytes in the above example). As long as offset is zero (0), following a 64bit value with a 32bit or less value, will always result in SetLength not being called. And as long as offset is zero, this procedure can never reduce the size of LBytes, it can only increase the size of LBytes. ***************************************************************************************************************** my work around was to create a method in my BT wrapper that creates a variable ClrValue of type TBytes set length to 1 call the method SetValue(ClrValue) This resets the TBluetoothGattCharactertistics property Value to be length 1 and thus the SetLength in the above code will always be called and the correct number of bytes will be transmitted. ***************************************************************************************************************** I went back and checked 10.1 Update2 and the same code as above is there. This may be expected behavior, I dont know, Other than my little work around, I found no intrinsic way to change the array length and thus the bytes transmitted. If you call SetValueAsUint32, I would expect 4 bytes to be transmitted, regardless of what was transmitted before.
  9. What is a way in Delphi FMX application to apply changes in SQLite database. F.e., there is an application v 1.0 in PlayMarked with the SQLite database v 0.1. New version 1.1 of an application comes with the database v 0.2 where was added new table, removed one field etc. How Delphi do (or not do and you did it instead) those migration work? When I was developing an application in Xamarin, there was a tool and it generated a "migration" script based on changes in DB classes, then Entity framework did all hard work.
  10. toufik

    The location of sqllite database ?

    good morning every one ^^ how is every one doing )) 1- i have fmx android app that s create sqllite db on create ,what's the location of db on the phone and is it const location ? (does not change for every other phones) 2- what's the proper way to copy it from that location to sd card (backup) ? thanks and take care
  11. Running a Delphi 10.4.1 (latest patch) FMX 64bit application on: Catalina : runs fine. High Sierra: on startup an EObjectiveC raises "ObjectiveC-class UNUserNotificationCenter not found" Does anyone have any idea where to look? Here the call stack: :000000010001C000 @DbgExcNotify :000000010001C03E System::NotifyReRaise(System::TObject*, void*) :000000010001C0DA System::_RaiseAtExcept(System::TObject*, void*) :000000010001C1F5 System::_RaiseExcept(System::TObject*) :00000001007117F5 Macapi::Objectivec::TOCGenericImport__2<System::DelphiInterface<Macapi::Usernotifications::UNUserNotificationCenterClass>, System::DelphiInterface<Macapi::Usernotifications::UNUserNotificationCenter> >::GetOCClass() :0000000100713D88 System::Mac::Notification::UserNotificationCenter() :0000000100712472 System::Mac::Notification::TNotificationCenterCocoa::TNotificationCenterCocoa() :0000000100715087 System::Mac::Notification::TNotificationCenterCocoa::GetNotificationCenter() :0000000100711B6E System::Mac::Notification::TPlatformNotificationCenter::GetInstance() :00000001007173F8 System::Notification::TBaseNotificationCenter::InternalGetInstance() :0000000100716AEC System::Notification::TCustomNotificationCenter::TCustomNotificationCenter(System::Classes::TComponent*) :0000000100111B7B System::Classes::TReader::ReadComponent(System::Classes::TComponent*)::CreateComponent(void*) :00000001000DE01D System::Classes::TReader::ReadComponent(System::Classes::TComponent*) :0000000100112008 System::Classes::TReader::ReadDataInner(System::Classes::TComponent*) :0000000100111EEF System::Classes::TReader::ReadData(System::Classes::TComponent*) :00000001000E8ACF System::Classes::TComponent::ReadState(System::Classes::TReader*) :00000001000DEC07 System::Classes::TReader::ReadRootComponent(System::Classes::TComponent*) :00000001000D8F8F System::Classes::TStream::ReadComponent(System::Classes::TComponent*) :0000000100104900 System::Classes::InternalReadComponentRes(System::UnicodeString, NativeUInt, System::Classes::TComponent*&) :000000010010C237 System::Classes::InitInheritedComponent(System::Classes::TComponent*, System::TMetaClass*)::InitComponent(void*, System::TMetaClass*) :000000010010C2DD System::Classes::InitInheritedComponent(System::Classes::TComponent*, System::TMetaClass*) :000000010058E52D Fmx::Forms::TCommonCustomForm::TCommonCustomForm(System::Classes::TComponent*) :00000001005963E7 Fmx::Forms::TCustomForm::TCustomForm(System::Classes::TComponent*) :00000001005898B8 Fmx::Forms::TApplication::CreateForm(System::Classes::TComponentClass, void*) :0000000100589799 Fmx::Forms::TApplication::RealCreateForms() :0000000100522D3E Fmx::Platform::Mac::TPlatformCocoa::Run() :000000010058A195 Fmx::Forms::TApplication::Run() main(1,0x00007ffeefbffa38,0x00007ffeefbffa48,0x00007ffeefbffaf0) :00007FFF78D07015 start :00007FFF78D07015 start
  12. my sample based on tip by Fernando Rizzato (MVP Embarcadero lead South America) unit uFormMain; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, System.Permissions, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Layouts, FMX.Controls.Presentation, FMX.StdCtrls, FMX.ListBox, FMX.Objects, FMX.ScrollBox, FMX.Memo, FMX.Media; type TfrmFormMain = class(TForm) lytFormMain: TLayout; lytFormMainToolBar: TLayout; lytFormMainClientArea: TLayout; tbarFormMainMenu: TToolBar; sbtnCAMStartCamera: TSpeedButton; cmbboxCAMDevices: TComboBox; imgVideoCapture: TImage; mmMyLog: TMemo; sbtnCAMStopCamera: TSpeedButton; procedure FormCreate(Sender: TObject); procedure sbtnCAMStartCameraClick(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure imgVideoCaptureTap(Sender: TObject; const Point: TPointF); procedure sbtnCAMStopCameraClick(Sender: TObject); procedure cmbboxCAMDevicesChange(Sender: TObject); procedure FormResize(Sender: TObject); procedure FormActivate(Sender: TObject); private procedure prcMyLog(lText: string); // procedure prcCAMDevicesSetting; procedure prcCAMStartCapture; // {$IF DEFINED(ANDROID)} procedure prcPermissionsResulted(Sender: TObject; const APermissions: TArray<string>; const AGrantResults: TArray<TPermissionStatus>); procedure prcDisplayRationale(Sender: TObject; const APermissions: TArray<string>; const APostRationaleProc: TProc); {$ENDIF} // procedure prcCAMSampleBufferReady(Sender: TObject; const ATime: TMediaTime); procedure prcCAMSampleBufferSync; public end; var frmFormMain : TfrmFormMain; FFormTopPositionBeforeResize: integer = 0; implementation {$R *.fmx} { This sample, will use the "TVideoCaptureDevice" (class base to "TCameraComponent") directly!!! This class is defined in "FMX.Media.pas" // TDialogService.ShowMessage() used for dont block main-thread! } // uses FMX.DialogService {$IF DEFINED(ANDROID)} , FMX.Helpers.Android, Androidapi.JNI.JavaTypes, Androidapi.Helpers, Androidapi.JNI.OS {$ENDIF} ; // var lMyCAMDevice : TVideoCaptureDevice; lMyCAMPermission: string; function fncMyIIF(lBooleanExpr: boolean; lTextTrue, lTextFalse: string): string; begin result := lTextFalse; // if lBooleanExpr then result := lTextTrue; end; procedure TfrmFormMain.prcMyLog(lText: string); begin mmMyLog.Lines.Add(lText); end; procedure TfrmFormMain.cmbboxCAMDevicesChange(Sender: TObject); begin {$IF NOT DEFINED(ANDROID)} try lMyCAMDevice := nil; // lMyCAMDevice := TVideoCaptureDevice(TCaptureDeviceManager.Current.GetDevicesByName(cmbboxCAMDevices.Selected.Text)); // sbtnCAMStartCamera.Enabled := not(lMyCAMDevice = nil); // except on E: Exception do prcMyLog('Error Start CAM' + #13#10 + E.Message); end; {$ENDIF} end; procedure TfrmFormMain.FormActivate(Sender: TObject); begin {$IF NOT DEFINED(ANDROID)} FFormTopPositionBeforeResize := Self.Top; { when the user move the forms, needs change it too! } {$ENDIF} end; procedure TfrmFormMain.FormClose(Sender: TObject; var Action: TCloseAction); begin if not(lMyCAMDevice = nil) then begin {$IF DEFINED(ANDROID)} // if PermissionsService.IsEveryPermissionGranted([lMyCAMPermission]) then; if PermissionsService.IsPermissionGranted(lMyCAMPermission) then {$ENDIF} begin if (lMyCAMDevice.State = TCaptureDeviceState.Capturing) then lMyCAMDevice.StopCapture; end; // // lMyCAMDevice.Free; // if necessary!!! end; end; procedure TfrmFormMain.FormCreate(Sender: TObject); begin {$IF NOT DEFINED(ANDROID)} FFormTopPositionBeforeResize := Self.Top; {$ENDIF} // // // Form.OnCreate is not better place to "critial" procedure! // Here, only basic procedures! // Self.Position := TFormPosition.ScreenCenter; sbtnCAMStopCamera.Text := 'Stop Cam'; // prcCAMDevicesSetting; // if necessary, move it for another place! // if not(lMyCAMDevice = nil) then begin prcMyLog(lMyCAMDevice.ToString); // unfortunatelly, dont have Name or Description on Mobile Android // sbtnCAMStartCamera.Enabled := True; end else prcMyLog('MyCAMDevice = nil'); end; procedure TfrmFormMain.FormResize(Sender: TObject); begin {$IF NOT DEFINED(ANDROID)} if (Self.Height <= 480) then begin Self.Top := FFormTopPositionBeforeResize; Self.Height := 480; end; // if (Self.Width <= 640) then Self.Width := 640; // to avoid that ComboBox is gone...! {$ENDIF} end; procedure TfrmFormMain.imgVideoCaptureTap(Sender: TObject; const Point: TPointF); {$IF DEFINED(ANDROID)} var lObject: string; {$ENDIF} begin {$IF DEFINED(ANDROID)} // for "TAPing" tests! // lObject := ''; // if not(Sender = nil) then lObject := Sender.ClassName; // TDialogService.ShowMessage( { } Format('Object=%s, Point X=%f, Y=%f, V[0]=%f, V[1]=%f, IsZero=%s', [ { } lObject, Point.X, Point.Y, Point.V[0], Point.V[1], { } fncMyIIF(Point.IsZero, 'is zero', 'is not zero') { } ])); {$ENDIF} end; procedure TfrmFormMain.prcCAMDevicesSetting; {$IF NOT DEFINED(ANDROID)} var DeviceList: TCaptureDeviceList; i : integer; {$ENDIF} begin {$IF DEFINED(ANDROID)} cmbboxCAMDevices.Visible := False; try // Normally, there is only 1 cam in Mobile! // // NOTE: any try to read or change any property from CAM, NEEDS "permissions"!!! lMyCAMDevice := TCaptureDeviceManager.Current.DefaultVideoCaptureDevice; // lMyCAMDevice.OnSampleBufferReady := prcCAMSampleBufferReady; // showing our video on TImage // // DONT TRY READ or CHANGE any property from CAMDevice here!!! // Like: Start or Stop, Quality, IsDefault, etc... // Only later your "permissions" to be given by user!!! except on E: Exception do prcMyLog('Error CAM definition' + #13#10 + E.Message); end; {$ELSE} DeviceList := TCaptureDeviceManager.Current.GetDevicesByMediaType(TMediaType.Video); // for i := 0 to (DeviceList.Count - 1) do cmbboxCAMDevices.Items.Add(DeviceList[i].Name); {$ENDIF} end; {$IF DEFINED(ANDROID)} // DisplayRationale and PermissionsResulted is used only mobile! procedure TfrmFormMain.prcDisplayRationale(Sender: TObject; const APermissions: TArray<string>; const APostRationaleProc: TProc); var lRationaleMsg: string; i : integer; begin for i := 0 to high(APermissions) do begin if APermissions[i] = lMyCAMPermission then lRationaleMsg := lRationaleMsg + 'This app needs access your CAM to works' + SLineBreak + SLineBreak; end; // // Show an explanation to the user *asynchronously* - don't block this thread waiting for the user's response! // After the user sees the explanation, invoke the post-rationale routine to request the permissions // TDialogService.ShowMessage(lRationaleMsg, procedure(const AResult: TModalResult) begin // TProc is defined in System.SysUtils // APostRationaleProc; // used by System to go-back in before function... end) end; procedure TfrmFormMain.prcPermissionsResulted(Sender: TObject; const APermissions: TArray<string>; const AGrantResults: TArray<TPermissionStatus>); begin // verifying if the permissions was granted! - Here, testing only 1 permission = CAM if (Length(AGrantResults) = 1) and (AGrantResults[0] = TPermissionStatus.Granted) then prcCAMStartCapture { execute your procedure here if all it's ok } else TDialogService.ShowMessage('The permission <<CAMERA access>> not allowed by user'); end; {$ENDIF} procedure TfrmFormMain.prcCAMSampleBufferReady(Sender: TObject; const ATime: TMediaTime); begin // ****** // DONT USE "main thread" to process something "critial" like: process images by Cam // or anyother that can "crash" your UI (user interface) or app!!! // *************************************************************** // If exist images to process, then, put it on a "queue" to execute it! // Here, "prcSampleBufferSync" will be called always in a queue from main thread (your app) // to "dont paralize it" while the images it's processed!!! // // .............."main thread".........."method called" // TThread.Queue(TThread.CurrentThread, prcCAMSampleBufferSync); // end; procedure TfrmFormMain.prcCAMSampleBufferSync; begin // // use your imagination, to redirect this buffer !!! :) // // in the meantime ... let's write the pictures coming from the camera in the TImage lMyCAMDevice.SampleBufferToBitmap(imgVideoCapture.Bitmap, True); // end; procedure TfrmFormMain.prcCAMStartCapture; begin if not(lMyCAMDevice = nil) then begin // to Mobile (Android), change properties from CAMERA, needs permission! {$IF DEFINED(ANDROID)} if PermissionsService.IsPermissionGranted(lMyCAMPermission) then {$ENDIF} begin try lMyCAMDevice.StopCapture; // to avoid any error below // lMyCAMDevice.Quality := TVideoCaptureQuality.PhotoQuality; // lMyCAMDevice.StartCapture; // starting video capture! // prcMyLog('CAM device = Capture stated!'); prcMyLog('CAM ' + fncMyIIF(lMyCAMDevice.IsDefault, 'is', 'is not') + ' Default'); prcMyLog('CAM ' + fncMyIIF(lMyCAMDevice.HasFlash, 'has', 'has not') + ' Flash'); except on E: Exception do prcMyLog('Error Start CAM' + #13#10 + E.Message); end; end {$IF DEFINED(ANDROID)} else TDialogService.ShowMessage('Then CAM device needs your permission to access it!'); {$ENDIF} end else TDialogService.ShowMessage('None CAM device defined!'); end; procedure TfrmFormMain.sbtnCAMStopCameraClick(Sender: TObject); begin if not(lMyCAMDevice = nil) then begin // Needs "permissions" to read or change CAM properties! // {$IF DEFINED(ANDROID)} if PermissionsService.IsPermissionGranted(lMyCAMPermission) then {$ENDIF} begin if (lMyCAMDevice.State = TCaptureDeviceState.Capturing) then lMyCAMDevice.StopCapture else lMyCAMDevice.StartCapture; end {$IF DEFINED(ANDROID)} else TDialogService.ShowMessage('The <<CAMERA access>> permission is necessary'); {$ENDIF} end; end; procedure TfrmFormMain.sbtnCAMStartCameraClick(Sender: TObject); begin {$IF DEFINED(ANDROID)} PermissionsService.RequestPermissions( { } [lMyCAMPermission], { } prcPermissionsResulted, { } prcDisplayRationale { = nil, if you DONT WANT show any message! } ); {$ELSE} prcCAMStartCapture; // MSWindows or macOS {$ENDIF} end; initialization lMyCAMDevice := nil; {$IF DEFINED(ANDROID)} lMyCAMPermission := JStringToString(TJManifest_permission.JavaClass.CAMERA); {$ENDIF} finalization end. hug
  13. @Anders Melander I recently saw this post from you, as a maintainer of the wonderful Graphics32 libary. https://en.delphipraxis.net/topic/4140-smooth-scaling-of-bitmaps/?do=findComment&comment=36266 So I hope that you and/or others might have more insights about the future of the Graphics32 project. I used it in the past very successfully, and would also nowadays bet on it, but the activity of this project is quite slow. Why is that, I cannot really understand ? I have seen attempts from ZhaoyiPeng, to bring Gr32 to FMX, but also this moves quite slow, or is stalled. I see effords from Angus Johnson, to push a new Image32 project. Is the Image32 based partly on Graphics32 technologie ( I'm afraid its not), or how does it fit all together ? I had no time to look into all that more deeply, but the Gr32 for FMX seems to be only a proof of concept, and many features still missing. My original though was that Gr32 is able to use different backends, so it might be possible to port this to FMX too. Since FMX makes use of GPU, I'm not really sure if Gr32 can beat this, but I think Gr32, on the other hand, has features that were not available in FMX right now, and still would make sense. Anyhow, beside FMX, for VCL this seems to be still the great choice for bitmap operations. So what is the status and the roadmap of this project ? Would be good to know. Is this lack of maintainers or lack of interested users ?
  14. Hi there, this is another chapter of my daily issues with Apple: Suddenly the update of IPA to AppStore of an formerly running app failed, when using the Transporter. I usually keep my Transporter open for days and weeks, maybe that causes sometimes an issue. From my research for this error I found a few possible reasons and solutions in the web, where I've tried to re-boot my VM first. Solution: 1. Just relaunch Transporter app, or quit and re-enter it again. (not tested, but sound reasonable). 2. Try completely shutting down your device and then turning it back on and trying. (I've tried this one). 3. Check the matching case of the SKU for new apps: E.g. "com.company.appName" wasn't accepted. If changed to "com.Company.AppName", matching the AppStore entry, it works. Sometimes solutions can be so easy, but I hardly see the easy one's very often 😥
  15. Delphi10.2.3: OTL, FMX, ACTIVEX DCOM i have a big problem in my code to call the parallel.Async many times i have 6 ActiveX DCOM in Delphi, and wanna call these in same time, to calculate an invoice, so in my exe i work with OTL to async all calls activex, i don't like to wait result or freeze my screen. Parallel.Async( procedure (const task: IOmniTask) var iInnerExc: integer; begin /// ***********************************************************/// { return Log} TLogSingleton.Instance().Log('Services XX calcul: Début appel.',True); //************************* PARALLEL ASYNC ****************************// // executed in background thread try // {Create instance de ViewModel annexes: XXServiceXX} mainViewModelPreCalculOTLLevel03 := CreateMainViewModelOTLLevel03Class; {Affecter le même Model principal} mainViewModelPreCalculOTLLevel03.Model := fModel; {Suscribe the observer in list} mainViewModelPreCalculOTLLevel03.Provider.Subscribe(fSubscriber); {Call VieModel.ServiceXX} mainViewModelPreCalculOTLLevel03.StartPrecalcul; except on e:exception do {call the raise, juste ci dessous, dans le onterminated Handle} raise Exception.Create('Exception lors du traitement de Service XX.'); end; end, Parallel.TaskConfig.OnTerminated( procedure (const task: IOmniTaskControl) var excp: Exception; begin // executed in main thread if assigned(task.FatalException) then begin {expoiler l'exception, captcher ci dessus} excp := task.DetachException; TErrorSingleton.Instance().Log(Format('Service XX: [Fin TASK Error]. %s:%s',[excp.ClassName, excp.Message]),True); FreeAndNil(excp); end else begin // executed in main thread { return Log} TLogSingleton.Instance().Log('Services calcul: [Fin TASK] Fin appel traitement.',True); SendNotification([actServiceXXFinish]); end; end )); the Active X Call in exe FMX: (the server activeX is integreted in framework, i don't have the source code, and i don't know haw it writen) _Dm_Dcom := CreateObject('SERVICE.XX.CLT.SERVICEXX', 'DEFAUT') as ICoServiceXX; //Instance of the DLL //CALL the function in ServiceXX_impl _Dm_Dcom.GETTRaitementServiceXX(SafeArrayIn,SafeArrayOut,FListnerForPushNotif ); //with SafeArrayIn =Json IN, and take result in SafeArrayOut; FListnerForPushNotif to send notification (Type Interface: Iunknow) the ActiveX initialization in every SERVICEXX (DLL) TAutoObjectFactory.Create(ComServer, TTest, Class_Test, ciMultiInstance, tmApartment); in this DLL; we have ServiceXX_impl unit, we have one function to call traitement in another class, we can found a communication with the IInterface (published) to send notif like this: (FListnerForPushNotif as IDataListnerForPushNotification).PushNotificationForLog('Message to send to client side'); //we have many logs types: event, Error, Exception //PushNotificationForLog, PushNotificationForError,PushNotificationForException this is my call, i repeat it 6 times, Parallel.Async( CALL01 ); Parallel.Async( CALL01 ); Parallel.Async( CALL02 ); Parallel.Async( CALL06 ); i don't need to freeze my exe, and i don't need to wait, with SendNotification([actServiceXXFinish]); or other Action like "actService01Finish", "actService02Finish" i can kown if my traitement is finished or not, finaly, if i write all 6 calls, i will fall in many and many problems, like freeze screen, and deadlock (the only solution kill the process crl+alt+supp), but if i write only one call, it will be perfect, i have, my result, but the freeze screen persist, Conclusion: 1- with many calls: problems: screen freeze, traitement not working, --> kill the process. 2- with one only call: problems: screen freeze: the "TAniIndicator" not working and the screen freeze when Delphi enter in the other DLL (activeX). Nota: the Exe is FMX (in another step it will be a Form application), the 6 services are DLL (ActiveX DCOM). plz help me
  16. Hello, I have my HTTPS proxy for my HTTP REST server. Both running on my development computer. I setup HTTPS proxy following instructions here: https://twigstechtips.blogspot.com/2016/01/nginx-how-to-set-up-ssl-reverse-proxy.html These instructions makes you generate two certificate files. KEY and PEM files. I added that PEM file in my project resources as resource type RCDATA and used identifier "my_ca". I used below link to prepare my security config xml https://stackoverflow.com/questions/56301765/self-signed-certificate-in-android-application-of-rad Using "@raw/my_ca" as in that stackoverflow question is failing with below error (while packaging the app) when I try to debug run the app. network_security_config.xml:6: error: Error: No resource found that matches the given name (at 'src' with value '@raw/my_ca/') So, I prepared my XML file as following: <?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config> <domain includeSubdomains="true">yourdomain.com</domain> <trust-anchors> <certificates src="my_ca"/> </trust-anchors> </domain-config> </network-security-config> When I try to access my REST server like https://192.168.1.152/... I get following error Failed to parse XML configuration from network_security_config On the other hand, I can get results just fine using identical URL and Postman on Windows OS. I simply failed to figure how to add that self signed certificate in my app package and use it. Any help is appreciated. Thanks & Regards, Ertan
  17. Hi all, I've been trying to integrate Facebook Audience Network into my Firemonkey app for ads and I'm getting a very strange error when linking for iOS. I use the "fake loader" approach to linking the framework. const libFBSDKCoreKitBasics = 'FBSDKCoreKit-Basics.framework/FBSDKCoreKitBasics'; //required as it's a dependency for the FBAN library libFBAudienceNetwork = 'FBAudienceNetwork-5.2.0.framework/FBAudienceNetwork'; function LibFBCoreKitBasics: Pointer; cdecl; external libFBSDKCoreKitBasics name 'OBJC_CLASS_$_FBSDKURLSessionTask'; function LibFBAN: Pointer; cdecl; external libFBAudienceNetwork name 'OBJC_CLASS_$_FBNativeAdView'; The error when I try to link, is this: ld: file is universal (4 slices) but does not contain a(n) arm64 slice: ..\Libraries\FBAudienceNetwork-5.2.0.framework/FBAudienceNetwork for architecture arm64 I've Googled and the only reference to this kind of error is related to armv7 when trying to link frameworks into a 64bit app that only contain 32bit versions. So I try building a 32bit version of my app in Delphi and see: ld: file is universal (4 slices) but does not contain a(n) armv7 slice: ..\Libraries\FBAudienceNetwork-5.2.0.framework/FBAudienceNetwork for architecture armv7 Which doesn't make any sense! It looks like the FBAudienceNetwork framework is essentially empty with neither 32 or 64bit code which can't be true as it's 1.7Mb and fresh from the official download page. I've tried different versions of the framework but get the same error each time so I've ruled out a corrupted download. I've tried linking through the "Linker Options" in the project settings instead but get the same errors. Linking the FBSDKCoreKit libraries works using the same approach. Does anyone have any ideas or know why I'm getting this error? Thanks in advance!
  18. I have just upgraded from Delphi 10.3 to 10.4. I have been using FastMM 4.992 in my projects. The main form has an initialization ReportMemoryLeaksOnShutdown := True; TfrmMain.SetMyStyle; SetMyStyle is defined class procedure TfrmMain.SetMyStyle; var sStyleFile: string; bOK: Boolean; sPath: string; begin sStyleFile := 'C:\DevFolder\21.0\bin\Win32\Debug\Styles\Calypso_Win.style'; if TFile.Exists(sStyleFile) then begin bOK := TStyleManager.SetStyleFromFile(sStyleFile); end; end; In 10.3 this works without any issues. In 10.4, FastMM4 generates an AV on closedown FastMM has detected an attempt to call a virtual method on a freed object. An access violation will now be raised in order to abort the current operation. Unfortunately the block header has been corrupted so no history is available. The current thread ID is 0x27F4 and the stack trace (return addresses) leading to this error is: 6DCB67 {FMX.Controls.pas][FMX.Conrols.TControl.Repaint][3547] 76A260 FMX.Styles.Objects.pas][FMX.Styles.Objects][Styles.OBjects.TButtonStyleObject.NormalTriggered][2357] .... I have GExperts install, and it generats a message Project xx.exe raised exception EAccessVioloation with message 'Access Violation at address 776B4662. Read of address 00000000'. This is in a new project, which has no components on the form. The only changes to the default new project are the uses in the dpr for FastMM, the class procedure, initialization and addition uses in the main form for FMX.Styles and System.IOUtils. The options I have changed in FastMM4Options.inc are {$define NeverUninstall} {$define UseRuntimePackages} {$define NoDebugInfo} {$define FullDebugMode} {$define CatchUseOfFreedInterfaces} {$define ClearLogFileOnStartup} {$define DisableLoggingOfMemoryDumps} {$define HideMemoryLeakHintMessage} The style I am using is Calypso_Win.style. This is one of the premium styles available through Getit. Does anyone have any idea of where I should be looking for the problem. Sue
  19. Andrea Raimondi

    Opening a document in FMX without custom code

    Hi! I know the code from Jim to open URLs, for example, but I am more looking for something like ShellExecute on Windows but cross platform. Any ideas? Thanks!
  20. Hi all, I just wanted to let you know my (long-awaited) FMX book is now available (actually it is rolling out on Packt and Amazon so availability may be different across different countries). If you like to read some details you can read my latest blog post: https://blog.andreamagni.eu/2020/10/book-delphi-gui-programming-with-firemonkey-now-available/ I really hope the book will be useful to spread Delphi and FMX as development platform. Thanks for the attention, Andrea
  21. Hi there, I'm sure most of you were aware of @Dave Nottage and his very helpful (live-saving) Kastri(Free) projects. Now with the presentation of the Memorizer, there are certain discussions about issues in the cross-platform world. Same as Dave I try to postpone permission requests to the bitter end, just before touching the hardware. For camera, sensors, etc. thats usually no issue. The problems may start when using local notifications, or related permissions, like Bluetooth and location. The local notifications permissions are fired right at startup, and thats annoying. You can imagine if you need a few permissions at startup, then they all will appear, and the user has to click them away before showing any useful screen. But for local notifications permission this might be maybe the right way too, because in mobile you also can run in foreground or background. So I would like to discuss the possibilities and pros and cons we have, for the permission settings from a users point-of-view. 1. Ask permission right after startup (as is now) - this is annoying to the user, especially if several requests appear one after the other - works in all cases, also for background mode, as it forces the user to decide - its a little like the old "Android way", permit all before use anything, but Androids style has changed meanwhile (for good reasons) - sometimes the app runs in background, and has no other chance to notify, than by local notification So the local notification permission shall be given at startup, to ensure this works. 2. Ask permission short before usage (in foreground) - thats what I like too, users shall decide each function before they use it. - but when moving to background w/o giving permission before, this might fail. A user cannot give permission while in background mode, the function simply fail or crash. 3. Ask permission short before going to background - this is not possible, because the app cannot do much when changing the states, especially no long-lasting alerts. 4. Allow permission in a special setup dialog - This is the "windows" setup philosophy, I think very much out of fashion in mobile: Force the user to visit setup first. - This will solve the issue in 2.), but I really try to to avoid this forcing of "setup" style design. Are there any other ideas or use-cases ? So far I think 1.) (as is) has its need too, and its not easy to cover all use-cases with one solution in mobile, there are too many options. Beside that, Android and iOS might have different philosophies as well, howto get them all under one umbrella ?
  22. @Dave Nottage Hi Dave, thanks for your nice article about a major problem in the Apple environment. Yes, Apple always keeps us busy with such unnecessary work. Since I had fallen into such nasty boobie trap in some older version before, I changed my way howto deal with these updates. So I may provide another (pseudo)-solution to this topic: Solution 3: ( prerequisites before starting any update ) Use your XCode environment for development in a VM virtual machine, like VmWare Fusion Make a backup of your VM image, BEFORE any update of the VM (if you prefer snapshots, thats fine too, if you cleanup later, but I prefer to make complete, FULL clones of the whole VM) In the VM backup also the current SDK's are backed up of course, if you ever need them again later With these FULL clones you can switch fast and easy between older and newer XCode, SDK and PAServer setups That doesn't solve the basic problem, of course, but makes it much easier to handle different SDK environments, in case of any "crash" might happen wit the new version.
  23. Hi, I try to run the following code on Android (10.4 Sydney) fn:=TPath.Combine(TPath.GetSharedDocumentsPath(),'OLA'); TDirectory.CreateDirectory(fn); // or ForceDirectories(fn) -> I tried both functions if TDirectory.Exists(fn,false) then showmessage('Ok') else showmessage('Failed'); And the code fail. The same code works without any problem with 10.3.3 (using the same phone) Note: On both environments I have used default User Permissions. including "Write external storage" Did you encountered this problem? - how did you solved? Thank you in advance, Pavel
  24. I'm still testing porting from 10.3.1 to 10.3.2 In one FMX project for Macos, when just opening and compiling the working project, I've got some messages when compiling under Macos64 (Of coarse it works well under all other platforms). 1.) This message is strange, because the Imports folder is not there at all, not even the 20.0\ folder, because I installed the IDE under d:\Prj\... Under d:\Prj\Embarcadero\Studio\20.0\Imports I have that folder (which is almost empty, just a subfolder with one VCL related file "\Idl\StdVCL.idl". 2.) Its strange because of the reference to kernel32.-dll I have searched my settings, compiler, linker, deployment, registry, but I'm not lucky and couldn't find where these locations are maybe set. My BDSCOMMONDIR environment variable points to a folder close: C:\Users\reg_w\OneDrive\Dokumente\Embarcadero\Studio\20.0, but thats working at all other platforms. Then I decided to completely migrate via an new, empty project, like I described here: Create new FMX app, removed orignal unit1 and added my units from the old project. So now I got a more informative message, but still similar: compiling OK, linking failed The empty project runs, but when I add my units, something went wrong. I'm not recalling to have anything affecting linking in my code, but I haven't checked that yet. Which screw could I turn to remove this linker error, I hope somebody has a clue ? Edit: As usual, just when I prepare and sended a thread, it hits me in the face what this could be. The folder seems to be related to Spring4D .. To get Spring4D compiled, I used the following addition to switch to PUREPASCAL, which seemed to compile fine. I'M using the development branch, from not too long ago (2 weeks), haven't checked for changes. {$I Spring.inc} {$IFDEF MACOS64} // <--Addition {$DEFINE PUREPASCAL} {$ELSE} {.$DEFINE PUREPASCAL} {$ENDIF MACOS64} unit Spring.Events; So probably I have to c heck what happens with Spring4D in my Macos64 tests ... How can I switch S4D to Macos64 in the right way ?
  25. Hi there, I'm looking for a scripting engine in my projects, and since I had last time contact with scripting this is some years ago. I would like to check out the pros and cons of the solutions, to find the best fitting match for me. Since paxCompiler seems gone by Apex, this is maybe out of sight now, but I'm not so sure about that. DwScript is not available on mobile, as far as I know. DwScript is somewhat available in different forks (so it seems), not sure which one is the right one to choose. Maybe the list of engines is nit final, please let me know if there is something missing. What I'm looking for is a script engine that has the following features (I've put the most important in bold) usage for some base analysis and event control lightweight very stable well supported and documented Pascal supporting multiple languages would perfect, but not a main criteria (JS, C++, C#, Basic) Multiple platforms Win, Macos, Linux, iOS, Android is a must have supporting full language support is nice to have, but not a must (I can skip the special stuff I would say). performance (not that critical, but should be able to process dynamic protocols behaviour reasonable well ) memory footprint good, active community Free to use in commercial products I hope you can bring some light in this dark forest of possibilities, and share some experiences.
×