Jump to content

Search the Community

Showing results for tags 'delphi'.



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

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 226 results

  1. Issue/Problem: when deploying an app to android that has the: (camera, json, or barcode components on a form) the app starts up with a black screen flame and hangs and closes down. Has anyone tried the trial version of TMS FNC WX Pack Android? -- link: https://www.tmssoftware.com/site/tmsfncwxpack.asp I have been having a difficult time with the trial version v1.5.1.0 (via Getit) working on my smartphone with Android 10, using Delphi 11.2 Alexandria Professional under Windows 7 and also Windows 10 laptops. The trial version states to set it in release mode (For mobile device deployment, the trial version supports deploying in release mode only) which I have done, but after the app is deployed I still have a black screen with the Delphi flame and it eventually closes whenever click out of the screen. I am hoping that someone with similar experience knows how to resolve this issue. I would really appreciate the help. Thank you.
  2. I'm having trouble connecting to my DROPBOX account via TidHTTP and I don't know what to do anymore. I want to send a simple text file to DROPBOX in the first stage. procedure TForm2.btn1Click(Sender: TObject); const API_URL = 'https://content.dropboxapi.com/2/files/upload'; cFile = 'D:\testfile.txt'; var wAccessToken : string; Source: TFileStream; IdHTTP: TIdHTTP; Res : string; Ssl: TIdSSLIOHandlerSocketOpenSSL; begin wAccessToken := 'muj_token'; IdHTTP := TIdHTTP.Create(nil); try (* ShowMessage('Indy version: ' + IdHTTP.Version); RESULT MESSAGE : INDY 10.5.9.0 *) IdHTTP.HandleRedirects := True; ssl := TIdSSLIOHandlerSocketOpenSSL.Create(); ssl.SSLOptions.Method := sslvTLSv1_2; ssl.SSLOptions.Mode := sslmUnassigned; ssl.SSLOptions.VerifyMode := []; ssl.SSLOptions.VerifyDepth := 0; ssl.host := ''; Source := TFileStream.Create(cFile, fmOpenRead); IdHTTP.IOHandler := ssl; IdHTTP.Request.CustomHeaders.Values['Authorization'] := 'Bearer ' + wAccessToken; IdHTTP.Request.CustomHeaders.Values['Dropbox-API-Arg'] := '{ "autorename": false,"mode": "add","mute": false,"path": "/test.txt","strict_conflict": false}'; IdHTTP.Request.CustomHeaders.Values['Content-Type'] := 'application/octet-stream'; Memo1.Lines.Add(IdHTTP.Request.CustomHeaders.Text); Res := IdHTTP.Post(API_URL, Source); finally IdHTTP.Free; end; But after the POST command I get the error "error: 1409442E:SSL routines: SSL3_READ_BYTES:tlsv 1 alert protocol" - class EIdOSSLUnderlyingCryptoError with message "Error connectin with SSL" http://imgway.cz/m/hneT.jpg I don't know how to proceed, there is a stupid mistake somewhere. I found similar problems on https://stackoverflow.com/questions/1742900/tidhttp-in-indy-10 , https://stackoverflow.com/questions/7762584/post-problems-with-indy-tidhttp and many other forums. Somewhere it says it may be old INDY (which it is), but DROPBOX's probably has the TLS v1.2 required when TIDHTTP enables it ssl.SSLOptions.Method := sslvTLSv1_2 For the Request track, I stuck to the DROBOX.API structure DROPBOX API DOCUMENTATION https://www.dropbox.com/developers/documentation/http/documentation#files-upload Get access token for: ****************************************************** ************** curl -X POST https://content.dropboxapi.com/2/files/upload \ --header "Authorization: Bearer <get access token>" \ --header "Dropbox-API-Arg: {\"autorename\":false,\"mode\":\"add\",\"mute\":false,\"path\":\"/Homework/ math/Matrices.txt\",\"strict_conflict\":false}" \ --header "Content-Type: application/octet-stream" \ --data-binary @local_file.txt ****************************************************** ************** Even more information: Delphi XE3 Indy 10.5.9.0 with the exe I have the Open SSL files libeay32.dll (v. 1.0.2.17) and ssleay32.dll (v. 1.0.2.17) - but that will not be it. if I throw them away the error is the same DROPBOX requires TLS 1.2 from April On some forums they wrote the same error with old Open SSL files, old INDY, sending via TLS which is not supported by the addressee. But I don't feel either way. I downloaded Open SSL from https://github.com/IndySockets/OpenSSL-Binaries file openssl-1.0.2u-x64_86-win64.zip (I don't know if it's good, there are a bunch of them in the table with differences in the name "r", "s", "t", "u", he chose I'm the last one). Thanks for any advice.
  3. BennieC

    Listview Programming

    Good day I am trying to build an application which requires me to display multiple images in groups with selectable sizes. The images consist of a bitmap and a text field. My idea is to put the image groups in a TListview (Which I hope can display horizontally) and then add these listview groups into a TFlowlayout to manage the screen layout. However, I simply do not get it right to create a TListview item programmatically to display the image. I have tried to create a TListItemImage as well as simply adding a TListViewItem but neither worked in that I could see anything on the screen. I am including my test code (Note it pulls images from a folder for testing). The commented out sections will probably indicate some of the experiments that I tried. I will probably also struggle to add the TListviews to the TFlowlayout. Some advice will be much appreciated. The idea is that the application will run on both Android mobile as well as desktops. prjFlowLO.dpr prjFlowLO.dproj uFlowLOMain.fmx uFlowLOMain.pas
  4. I am trying to work out some issues with compiling certain components and need to list out all installations that pertain to Android development. I use the Android SDK tool to install various Android files. Although I can compile apps and deploy them to my Android device, I believe that I have messed things up pretty well, I think. F:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\adt-bundle-windows-x86-20131030\sdk\tools\ --> Android Tools And I want to list out the same details seen below but in "text" format (so that I can post it to someone). I don't want to post it as an image like the below, plus also because there are a lot more info not seen in this image below and would require multiple images to post, and it would be better to post a text file and send that off to the person. Is there a command line tool that I can use to obtain the same text and layout? I can clean it up to look in a similar layout as in the image just above if I have to. Thanks.
  5. dkjMusic

    App is faster in IDE

    I am deveoping an app in Delphi 10.3 Community Edition. At one point the program retrieves equation parameters from a MS Access datbase and calculates x's and y's for a set of plots. It does this to produce 15 TCharts with 9 line series each. I have found that these operations often take much longer to execute when I run the standalone app as compared to running the app in the IDE. Below is a table of execution times (using GetTickCOunt). The columns are TChart graph #, milliseconds in the IDE, and milliseconds for standalone. # IDE SA -- --- ----- 1 703 14890 2 875 500 3 844 14828 4 829 14844 5 875 468 6 812 500 7 906 14859 8 1281 14813 9 938 14860 10 829 14875 11 15562 14844 12 937 14859 13 927 14860 14 812 531 15 828 14868 What could explain the differences in execution times and what can I do to decrease the times for the standalone execution?
  6. Windows 7 Home 64bit Delphi XE7 Professional update 1 with FireDAC and Mobile add-on Indy version 10.6.1.518 Android version 10, (on smartphone) Android versions 4.4.4, and 4.4.2 (both on tablets) Issue/Problem: When I launch the app on Android, and click on the [Submit] button, the app shuts down when it tries to access the idhttp section here: idHttp1.get(url_address); It works fine under Windows FMX and VCL, just not Android. Can someone please help me resolve this? Thank you. History: Hi. I have been successfully creating small utility apps on my android devices (Galaxy S10+ (android 10) and tablets (android 4.x.x)) for the last 8 years. I've been playing around with a new windows project using API through OMdbAPI (an IMDB knock-off) to get quick movie/tv series info. The API is free for 1000 requests. I love it. It works well. Usage is simple, using the following -> [https://www.omdbapi.com/?t=Contact&apikey={8-dig-key-code}] as it will give back a JSON string (below), then I parse it to get back a two-column detail to visualize the data better. Later I plan to fine-tune it and display only certain info from it. Right now, I am simply debugging it on Windows 7 and Android. {"Title":"Contact","Year":"1997","Rated":"PG","Released":"11 Jul 1997","Runtime":"150 min","Genre":"Drama, Mystery, Sci-Fi","Director":"Robert Zemeckis","Writer":"James V. Hart, Michael Goldenberg, Carl Sagan","Actors":"Jodie Foster, Matthew McConaughey, Tom Skerritt","Plot":"Dr. Ellie Arroway, after years of searching, finds conclusive radio proof of extraterrestrial intelligence, sending plans for a mysterious machine.","Language":"English, Spanish, German, Russian","Country":"United States","Awards":"Nominated for 1 Oscar. 14 wins & 32 nominations total","Poster":"https://m.media-amazon.com/images/M/MV5BYWNkYmFiZjUtYmI3Ni00NzIwLTkxZjktN2ZkMjdhMzlkMDc3XkEyXkFqcGdeQXVyNDk3NzU2MTQ@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"7.5/10"},{"Source":"Rotten Tomatoes","Value":"68%"},{"Source":"Metacritic","Value":"62/100"}],"Metascore":"62","imdbRating":"7.5","imdbVotes":"274,457","imdbID":"tt0118884","Type":"movie","DVD":"16 Dec 1997","BoxOffice":"$100,920,329","Production":"N/A","Website":"N/A","Response":"True"}
  7. karl Jonson

    XML validation

    XML validation. I have an Object Pascal application which generates XML similar to this one: <book> <name>Anna Karenina</name> <author>Leo Tolstoy</author> <publisher>The Russian Messenger</publisher> <price>$16.79</price> </book> Which is the best way to add code which validates the above XML (in the generating app) ? I would like to make sure that: A book must have an author. A book price cannot exceed $100 TIA
  8. Philip Ostle

    Delphi Registration

    A sad tale, The issue of registration of running Delphi has change markedly over the past few years. I have been using Delphi since Delphi 1 and dip in every few years or so to upgrade. Always using a Named User Licence and only occasionally installed it on different machines, so a Named Network User licence was not really needed. I bought Delphi 10.4 early last year and it came with a 1 year maintanance, which expired in March. My main Laptop died (or is in the last thros of death) so I bought a new one and sucessfully installed it on the new machine and started the process of transferring all the stuff I needed to the new machine. Ok, so I renamed the old laptop to '....Old' and renamed my new laptop to something more appropriate but .... when I tried to run Delphi... it wanted to be registerEd again. I though nothing of it so ... I did on the old machine but when I tried on the new machine , I was informed that I had run out of install licences (apparently it is 3 now, it used to be way way more!). I re-named my new laptop back to what it was so at least it would work and ... It needs to register again and won't as I have used up all 3 slots. I read that the number of installs can easily be bumped up so I e-mailed Embarcadero and explained "exactly" what had happened. They refused on the grounds that while they could do it, I needed an active subscription. (see Registrationn Limits below) They pointed out that it was already registered to run on 3 machines. I pointed out that they were the same machines and only the Machine Name had changed... No joy They then tried the "it's a subscription only license and has expired" , but a copy of my licence clearely states "perpetual"...registered to me etc etc. Nowhere does it say anything about being restriced to a machine name. After many lengthy e-mails to Embarcadero, nothing has been resolved. I said 'delete all the previous' .. nope I said increase the counter ... nope I have a working copy on my old laptop (which used up 2x licences due to re-naming) which will be dead soon and I cannot install it on my new laptop even though it has been installed and registered on that machine before. They have said that if I pay for a maintainance, they will happily increase the counter. Is this now ransomware? possibly. Is it counter to the terms and spirit of the lscence agreement? yes. Is it Illegal? probably. This whole issue is due to the licence being registered to the "Machine Name", and not to me ... Or so it seams and it does not keep account of the previous names that the machine had so it can check before it wipes everything out. I do not think it unreasonobale to expect people to rename their computers. people do it all the time. from Embarcadero’s Atanas Popov https://blogs.embarcadero.com/from-the-gm-new-updates-and-changes-to-the-registration-bumps-policy/ Registration Limits We have noticed compliance issues and increased Support efforts related to registration limit increases for customers on older product versions, who are no longer on Update Subscription. It is a standard industry practice to provide support to the most recent versions and to customers who have extended maintenance. We updated our processes and now route all issues raised from users who are not on Update Subscription to Sales and Renewals. We realize this is a change to previous operations and to reduce the impact to development projects, we issued a one-time registration limit increase for all customers who are close to hitting their registration count limit. This should address issues with re-installs of your licensed software on existing or new machines. Further, we will continue to look for options to make this more seamless through automation. Apparently, I have a previous version because I do not have an update subscription. Nor do I want one.! Apparently, they have found no "options to make this seamless" after an extensive search. Be warned DO NOT RENAME YOUR MACHINE I may have to bight the bullet and hand over some cash
  9. I have an XML file produced by Media Companion for a movie, I have used the Data Binding wizard to produce a schema from a dtd file. I can retrieve almost all the details from the file except when there is a list. <uniqueid type="tmdb">745272</uniqueid> <uniqueid type="imdb" default="true">tt13095604</uniqueid> How do I retreive the value for uniqueid>imdb I cannot find any assistance via google that explains this situation. Or am I missing something really simple I have attached the files The Phenomenon (2020).nfo is the XML file cm_movieinfo.dtd is the Document Schema cm_movieinfo.xdb is the generated Delphi Data Binding Unit. cm_movieinfo.dtd The Phenomenon (2020).nfo cm_movieinfo.xdb
  10. [See 2nd Post on Solution] I keep hitting this road-block. There no source code it's pointing to. It's just pointing to CPU assembly code. It's always the same segment fault. How do I trace it down? The segment fault happens when it gets around 33 or 34 files of ran*.txt. There's plenty of space left to create hundreds more files, but it likes to stop around 33 or 34 on the ran*.txt Tfile.copy? I added true to the end of it... but the overwrite parameter didn't help. Error: BFD: C:/Users/alt/Documents/Embarcadero/Studio/Projects/Filler/Android/Debug/FSP/debug/linker: don't know how to handle section `.relr.dyn' [0x 13] Process FSP.apk (4871) [Switching to Thread 5055] Process FSP.apk (4871) First chance exception at $BD9F069E. Exception class Segmentation fault (11). Process FSP.apk (4871) BD9F069E F8525023 ldr.w r5, [r2, r3, lsl #2] BD9F06A2 BF08 it eq BD9F06A4 2608 moveq r6, #8 BD9F06A6 4281 cmp r1, r0 BD9F06A8 EA460605 orr.w r6, r6, r5 BD9F06AC F8426023 str.w r6, [r2, r3, lsl #2] BD9F06B0 D1EE bne.n 0xbd9f0690 call stack thread --> :BD9F069E ??() :BD9A21A6 ??() :BD9A21A6 ??() it doesn't tell me where the error is... but I suspect it to be in this procedure because it's in the middle of creating the ran*.txt files: Global variables: var Form1: TForm1; FileDirectory, RandomFileToCopy: String; FilePermissions, DeleteFiles, DeleteInProgress: boolean; DeleteDirectoryList: TArray<system.string>; MaxFreeSpace: Int64; debugLines: TStrings; dButtonPreviousIsPressed: boolean; breakit: boolean; copydataActive: boolean; const FillerDiectoryNameConst = 'FILLER'; Procedure that I believe to be causing the segment fault: procedure TForm1.CopyData(); var DriveStr : String; FileNameCounter : integer; FolderCounter : integer; FolderName : string; FolderArea : string; RandomFileName : String; begin copydataActive := true; RandomFileToCopy := ''; FileNameCounter := 0; FolderCounter := 0; DriveStr := FileDirectory + TPath.DirectorySeparatorChar; RandomFileToCopy := DriveStr + 'random.txt'; // create random file //CreateNewRandFile(64000000); //64 mb file CreateNewRandFile(640); //640 file for testing purposes inc(FolderCounter); FolderName := 'rand' + IntToStr(FolderCounter); FolderArea := FileDirectory + TPath.DirectorySeparatorChar + FolderName; LabelLine2.Text := ''; while DirectoryExists(FolderArea) = true do begin inc(FolderCounter); FolderName := 'rand' + IntToStr(FolderCounter); FolderArea := FileDirectory + TPath.DirectorySeparatorChar + FolderName; LabelLine1.Text := 'Folder: ' + FolderName; if breakit = true then exit; end; try TDirectory.CreateDirectory(FolderArea); dString('CreateDirectory:'+FolderArea); except on E : Exception do begin dString('CreateDirectory(FolderArea):'+E.ClassName+' error: '+E.Message); copydataActive := false; exit; end; end; while CheckDiskSize(FolderArea) > 0 do begin if breakit = true then exit; RandomFileName := FolderArea + 'ran' + IntToStr(FileNameCounter) + '.txt'; FileNameCounter := 0; while FileNameCounter<126 do begin inc(FileNameCounter); RandomFileName := FolderArea + TPath.DirectorySeparatorChar + 'ran' + IntToStr(FileNameCounter) + '.txt'; try //if FileExists(RandomFileName) = true then DeleteFile(RandomFileName); LabelLine1.Text := 'Creating: ran' + IntToStr(FileNameCounter) + '.txt'; dString('Create RandomFile:'+RandomFileName); sleep(50); //dString writes to a file log file. TFile.Copy(RandomFileToCopy, RandomFileName, true); Except On E: Exception Do begin dString('TFile.Copy(RandomFileToCopy, RandomFileName):'+E.ClassName + ' ERROR: ' + E.Message); breakit := true; //break on error end; end; if breakit = true then exit; end; while DirectoryExists(FolderArea) = true do begin inc(FolderCounter); FolderName := 'rand' + IntToStr(FolderCounter); FolderArea := FileDirectory + TPath.DirectorySeparatorChar + FolderName; LabelLine1.Text := 'Folder: ' + FolderName; if breakit = true then exit; end; // all else fails... and it still is true... exit if DirectoryExists(FolderArea) = true then begin copydataActive := false; exit; end; try TDirectory.CreateDirectory(FolderArea); dString('CreateDirectory:'+FolderArea); except on E : Exception do begin dString('CreateDirectory(FolderArea):'+E.ClassName+' error: '+E.Message); copydataActive := false; exit; end; end; end; copydataActive := false; end;
  11. I did discovered a bug i guess by accident. I wanted to expand my own .inc file to support FreePascal but compiler did not let me. {$IF Defined(FPC)} {$IF Declared(FPC_VERSION)} {$IF FPC_VERSION >= 3} // [Pascal Error] kz.inc(80): E2026 Constant expression expected {$DEFINE UNICODE} {$IFEND FPC_VERSION} {$IFEND FPC_VERSION} {$IFEND FPC} A fix was to do it like this, himitsu from german Delphi-Praxis came up with: {$IF Defined(FPC) and Declared(FPC_VERSION) and (FPC_VERSION >= 3)} {$DEFINE UniCode} { FreePascal UniCode support } {$IFEND} I did open a Report -> Conditional Compiling dont work as expect If you think i was wrong, please correct me.
  12. I have a type LabView created DLL that creates the following structure: typedef struct { int32_t dimSizes[2]; double elt[1]; } DoubleArrayBase; typedef DoubleArrayBase **DoubleArray; void __stdcall SimpleDoubleArray(int32_t Channels, int32_t Points, DoubleArray *DoubleArray); In Delphi have defined the structure as follows: type PDoubleArray = ^DoubleArray; DoubleArray = ^PDoubleArrayBase; PDoubleArrayBase = ^DoubleArrayBase; DoubleArrayBase = packed record dimSizes: array[0..1] of Int32; elt: array[0..0] of Double; end; var procedure SimpleDoubleArray(Channels, Points : Int32; TestDoubleArray: PDoubleArray);stdcall; external DLLDirectory; and call the function : procedure TForm8.btn1Click(Sender: TObject); var TestDoubleArray : DoubleArray; begin SimpleDoubleArray(5,5,@Testdoublearray); end; My question is that when i assign the DoubleArray as the output of a function, how do i read the information that is stored in the TestDoubleArray? In other words, how do i access the DoubleArrayBase record values of dimSizes and elt from the TestDoubleArray variable that i passed to the function? I am basically translating what is done in this post: https://lavag.org/topic/20486-lv-dll-creates-mysterious-doublearray-class/ to a Delphi equivalent.
  13. I gonna run python script in separate thread. My PythonEngine has IO field assigned with TPythonGUIInputOutput component What is the correct way to synchronize output (e.g. print("Hello World!") to Delphi's TMemo component? As far as I know VCL is not thread safe... Thank you.
  14. I have a Delphi 10.4.2 project that has issues when clicking the file [lighttheme.pas] in the Projects window on the right. It won't open the file. I loads information into the Object Inspector but the file doesn't create a tab at the top. This file does not an associated .DFM. Its a unit file that holds procedures. The only way i can get it to open where i can edit it is to close my project then choose File | Open...and open the file that way. I have also tried to remove it and re-add it to my project with no change. Something is stuck somewhere. Any ideas?
  15. Nicolò Blunda

    Get copyright info from code in macOS

    Hello. With this code (working on macOS) I get application version info: VersionInfoString:= (TNSString.Wrap(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle, kCFBundleVersionKey))).UTF8String; I want to retreive the copyright info too. In info.plist the copyright string is the NSHumanReadableCopyright key value. It is possible to adapt code above to get it?
  16. Habarisoft released new versions of its native STOMP client libraries for Delphi / Object Pascal for open source message brokers: * Habari Client for ActiveMQ 7.2 – tested with Apache ActiveMQ 5.16.5 and 5.17.1 * Habari Client for Artemis 7.2 – tested with Apache ActiveMQ Artemis 2.23.1 * Habari Client for OpenMQ 7.2 – tested with Eclipse OpenMQ 6.3.0 * Habari Client for RabbitMQ 7.2 – tested with RabbitMQ 3.9.22 and 3.10.7 Release notes Full release notes can be found at: https://www.habarisoft.com/release_notes.html Home page, demo download, full documentation: https://www.habarisoft.com/ About Habari STOMP Client libraries Habari STOMP Client libraries enable Object Pascal applications to take advantage of message broker / message queue technology - which is distributed, loosely coupled, reliable and asynchronous - to build integrated systems, using peer-to-peer and publish-subscribe communication models.
  17. I have a TEdgeBrowser log into a website that has PDF records we need to download to our system. When I enter the URL for the PDF, the PDF is loaded into the browser. How can I download the PDF instead of displaying it? Thanks, Sidney
  18. Clément

    Project manager feature

    Hi, I was wondering if there's a feature (or plugin) that would allow me to right click a folder and add a new unit direct in that folder. For example: When I right-click "task.code" folder, I would like the context menu to display two new options "add new unit" and "add new existing unit". When selecting "add new unit", "Unit1.pas" would be created under "task.code" allowing me to renaming that unit directly and start working on it. Do you know if there's such a tool? I'm using D11.1 TIA, Clément
  19. Hi all. To complete my first Python + DelphiVCL program I need to expose to Python an extra Image Viewer Control. I don't want to create a custom delphivcl.pyd which is a good thing remains original and installable with pip install delphivcl, so I've tried to add the component in a custom package. Well, seems simple to do but does not work fine... The control to expose is TImgView32 which inherits from: TImgView32->TCustomImgView32->TCustomImage32->TCustomPaintBox32->TCustomControl so it is close to TLabel and looking at DelphiVCL code I've made same steps: library cnc_vision_ext; uses osPyCncVisionExt in 'sources\osPyCncVisionExt.pas'; exports PyInit_cnc_vision_ext; {$E pyd} begin end. unit osPyCncVisionExt; interface uses PythonEngine; function PyInit_cnc_vision_ext: PPyObject; cdecl; implementation uses System.Classes, System.SysUtils, System.Variants, Winapi.Windows, Vcl.ExtCtrls, VarPyth, WrapDelphi, WrapVclExtCtrls, WrapVclControls, WrapDelphiClasses, GR32_Image; type TPyDelphiImgView32 = class(TPyDelphiControl) private function GetDelphiObject: TImgView32; procedure SetDelphiObject(const Value: TImgView32); public class function DelphiObjectClass: TClass; override; property DelphiObject: TImgView32 read GetDelphiObject write SetDelphiObject; end; TPyExtensionManager = class private FEngine: TPythonEngine; FModule: TPythonModule; FWrapper: TPyDelphiWrapper; public procedure WrapperInitializationEvent(Sender: TObject); end; var ExtensionManager: TPyExtensionManager; { module import functions } function PyInit_cnc_vision_ext: PPyObject; begin Result := nil; try ExtensionManager.FEngine := TPythonEngine.Create(nil); ExtensionManager.FEngine.AutoFinalize := False; ExtensionManager.FEngine.UseLastKnownVersion := True; ExtensionManager.FEngine.LoadDllInExtensionModule(); ExtensionManager.FModule := TPythonModule.Create(nil); ExtensionManager.FModule.Engine := ExtensionManager.FEngine; ExtensionManager.FModule.ModuleName := 'cnc_vision_ext'; ExtensionManager.FWrapper := TPyDelphiWrapper.Create(nil); ExtensionManager.FWrapper.Engine := ExtensionManager.FEngine; ExtensionManager.FWrapper.Module := ExtensionManager.FModule; ExtensionManager.FModule.Initialize; ExtensionManager.FWrapper.OnInitialization := ExtensionManager.WrapperInitializationEvent; ExtensionManager.FWrapper.Initialize; Result := ExtensionManager.FModule.Module; except end; end; { TPyDelphiImgView32 } class function TPyDelphiImgView32.DelphiObjectClass: TClass; begin Result := TImgView32; end; function TPyDelphiImgView32.GetDelphiObject: TImgView32; begin Result := TImgView32(inherited DelphiObject); end; procedure TPyDelphiImgView32.SetDelphiObject(const Value: TImgView32); begin inherited DelphiObject := Value; end; { TPyExtensionManager } procedure TPyExtensionManager.WrapperInitializationEvent(Sender: TObject); begin FWrapper.RegisterDelphiWrapper(TPyDelphiImgView32); end; initialization ExtensionManager := TPyExtensionManager.Create; finalization ExtensionManager.Free; end. Well, compilation OK and import on Python OK, but when I try to create the object assigning the parent I got that: from delphivcl import * from cnc_vision_ext import * class TestForm(Form): def __init__(self, owner): # print type of self ('__main__.TestForm') print(type(self)) # create a vcl label and assign parent: WORKS self.label = Label(self) self.label.Parent = self self.label.Left = 10 self.label.Top = 10 self.label.Caption = 'Hello World' # create a ext image and assign parent: ERROR self.image = ImgView32(self) # <-- AttributeError: Owner receives only Delphi objects self.image.Parent = self self.image.Left = 10 self.image.Top = 30 self.image.Width = 200 self.image.Height = 100 def main(): Application.Initialize() Application.Title = 'test' MainForm = TestForm(Application) MainForm.Show() FreeConsole() Application.Run() if __name__ == '__main__': main() ù If I check with a Python console the types seem very close: D:\x\develop\qem\cnc_vision_1>python Python 3.9.12 (tags/v3.9.12:b28265d, Mar 23 2022, 23:52:46) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from delphivcl import * >>> from cnc_vision_ext import * >>> frm = Form(None) >>> lbl = Label(frm) >>> lbl.Parent = frm >>> type(lbl) <class 'Label'> >>> lbl.__doc__ 'Wrapper for Delphi TLabel\n' >>> lbl.ClassName 'TLabel' >>> img = ImgView32(frm) # does not work with frm as like as lbl Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: Owner receives only Delphi objects >>> img = ImgView32(None) # try with none to check object type >>> type(img) <class 'ImgView32'> >>> img.__doc__ 'Wrapper for Delphi TImgView32\n' >>> img.ClassName 'TImgView32' Thank you in advance for any suggestion 🙂
  20. delphi159

    Clientdataset's delta becomes empty

    I have "briefcase model application". Clientdataset reads data from xml-file. After closing modified data are saved in the xml-file. When click on "applyUpdate" button, data are saved in firebird db. If I don't exit program then ApplyUpdate works properly and commits delta-packet in db but sometimes, after closing-opening program 3- 4-5 times, for no clear reason delta becomes empty and after that if I click on "apply" button ApplyUpdates(-1) operator causes exception "access violation". Delphi 10.4, update 2. Firebird3. Project and db files on google drive: https://drive.google.com/drive/folders/1UvtGmaWLdmmSYQITWpEvp-BwRNmw9VEL?usp=sharing unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, FireDAC.Stan.Async, FireDAC.DApt, Datasnap.DBClient, FireDAC.Comp.DataSet, FireDAC.Comp.Client, Datasnap.Provider, Vcl.StdCtrls, Vcl.Buttons, Vcl.ComCtrls, Vcl.Grids, Vcl.DBGrids, FireDAC.UI.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.FB, FireDAC.Phys.FBDef, FireDAC.VCLUI.Wait, MidasLib; type TForm1 = class(TForm) LabelStatus: TLabel; LabelChangeCount: TLabel; DBGrid: TDBGrid; bApply: TBitBtn; DBGrid2: TDBGrid; bClose: TButton; bOpen: TButton; bMerge: TBitBtn; DataSource1: TDataSource; DataSetProvider1: TDataSetProvider; qGoods: TFDQuery; cdsGoods: TClientDataSet; DataSource2: TDataSource; FDConnection1: TFDConnection; FDTransaction1: TFDTransaction; qGoodsGOODS_ID: TIntegerField; qGoodsGOOD: TWideStringField; qGoodsQNT: TWideStringField; procedure bApplyClick(Sender: TObject); procedure bCloseClick(Sender: TObject); procedure bOpenClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure cdsGoodsAfterPost(DataSet: TDataSet); procedure DataSource1DataChange(Sender: TObject; Field: TField); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } public { Public declarations } end; var Form1: TForm1; FN: TFileName; MySavePoint: integer; Modified: boolean; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin qGoods.Open; FN:= ExtractFilePath(ParamStr(0)) + 'cds.xml'; cdsGoods.filename:= FN; cdsGoods.Close; cdsGoods.open; MySavePoint:= cdsGoods.SavePoint; end; procedure TForm1.bApplyClick(Sender: TObject); begin cdsGoods.ApplyUpdates(-1); qGoods.Refresh; MySavePoint:=cdsGoods.SavePoint; Modified:= false; end; procedure TForm1.bCloseClick(Sender: TObject); begin cdsGoods.Close; end; procedure TForm1.bOpenClick(Sender: TObject); begin cdsGoods.Open; end; procedure TForm1.cdsGoodsAfterPost(DataSet: TDataSet); begin Modified:= true; end; procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField); begin case cdsGoods.UpdateStatus of usUnmodified: labelStatus.Caption:='record didnt change'; usModified: labelStatus.Caption:='record was modified'; usInserted: labelStatus.Caption:='record was inserted'; usDeleted: labelStatus.Caption:='record was deleted'; end; end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin qGoods.close; cdsGoods.Close; end; procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin if Modified then case application.MessageBox(PwideChar('Data were changed. Save changes?'), '', MB_YESNOCANCEL+MB_ICONQUESTION) of IDCancel: CanClose:=false; IDNo: cdsGoods.SavePoint:=MySavePoint; // IDYES- no needed. Cds is saved auomatically after close // cdsGoods.saveToFile(FN); end; end; end.
  21. Piotr0603

    Deployment Android apk

    Hi, I am new in Delphi (10.4 Community Edition) developing on Android devices. I want to add a little text file to my apk on Android device. I do all what is described in https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Deployment_Manager: (Alexandria or 10.4 - the diffirence does not matter I think) 1. choose file in my laptop (Windows 10) - file is shown in Deployment Manager with the same name 2. in column "remote path" write the name of directory on Android device: .\assets\internal\Android\data\com.android.Tuczarnia\files\ (Tuczarnia is the name of apk) 3. build the apk 4. my file can't be found on folder ..internal\Android\data\com.android.Tuczarnia\files\ 5. I noticed that 'Connect" button in Deployment Manager is not active and all files have status "Not Connected", but it seems (after reading help of Deployment Manager) that this works automatically for Android 6. and I noticed, after unzipping the "apk" file, that my file is present in "assets/internal/Android/data/com.android.Tuczarnia/files/" inside that file 7. so it seems to me, that file is lost during the process of installing the apk - WHY? I use and have 1. Windows 10 2. Delphi 10.4 Community Edition 3. phone Xiaomi Redmi 8 with Android 10 Important: my application works fine without adding this file, application has over 10 screens and uses SQLite with no problems. So only one and new problem is adding new file. Thanks in advance to everyone piotr0603
  22. How to set the affinity for TOmniThread/TOmiTaskControl, it is keep on resetting the default affinity value (utilizing all CPU's). I tried setting Environment.Process.Affinity.AsString, but this value also keep on changing to default (255), it is happening when the OmiThread starts, I see it have many properties to set the affinity, but I'm not sure how to set it.
  23. I want to write some simple application (the app I've always dreamed of) that will show Football Chamionships (user can enter match results and app will show tables and some statistics). My problem is sorting groups in Chamionships Group Stage (Quatar 2022). As we know, there are 8 groups (A-H) with 4 Teams each. Lets focus on Group A. So, we have 4 teams: A1, A2, A3 and A4. ONLY 2 OF THEM CAN PLAY IN KNOCKOUT STAGE. How to know which one? Anyone of you solved such problem? FIFA says: The ranking of teams in the group stage is determined as follows: 1. Points obtained in all group matches; 2. Goal difference in all group matches; 3. Number of goals scored in all group matches; 4. Points obtained in the matches played between the teams in question; 5. Goal difference in the matches played between the teams in question; 6. Number of goals scored in the matches played between the teams in question; 7. Fair play points in all group matches (only one deduction can be applied to a player in a single match): - Yellow card: −1 point; - Indirect red card (second yellow card): −3 points; - Direct red card: −4 points; - Yellow card and direct red card: −5 points; 8. Drawing of lots. I need to cover 6 points (7 and 8 can be ignored for the moment). There are 6 matches in Group, each Team play with another from group. A1:A2 | A3:A4 A1:A3 | A4:A2 A4:A1 | A2:A3 I have no idea how to sort teams with FIFA guidelines. Have you got any idea? How to cover all conditions in one sort function? Could you maybe write for me some code to show how to do this? Ps: If this is to difficult/complex - how much many would it cost for you to write some simple solution for me? -Pawel
  24. misc_bb

    PDF Library

    Any recommendations for Delphi library for PDF handling? I'm currently working on merging multiple files into 1 pdf file. Fast-reports said it handle this, any thoughts?
  25. tinyBigGAMES

    GameVision Toolkit

    Ahh, finally at a point where I can start to update my GameVision framework to support modern PCs. This new generation will power upcoming game projects. I created a Facebook group for it, and I plan to post frequently about my progress. If you wish to follow, then you're invited to the cookout. Stop by and hang. Cold beer, burgers on the grill. LOL. https://www.facebook.com/groups/gamevisiontoolkit
×