-
Content Count
1406 -
Joined
-
Last visited
-
Days Won
22
Everything posted by programmerdelphi2k
-
...CODE into create()...? what is?
-
what is done (code) on DM.Create(...)?
-
tjsoniterator How to fill TListViewItem using TJsonIterator ?
programmerdelphi2k replied to wright's topic in Network, Cloud and Web
maybe some like this help you uses System.Generics.Collections, System.JSON; (* [ {"address": {"building": "1007", "coord": [-73.856077, 40.848447], "street": "Morris Park Ave", "zipcode": "10462"}, "borough": "Bronx", "cuisine": "Bakery", "grades": [....], // many sub-array here! "name": "Morris Park Bake Shop", "restaurant_id": "30075445"}, ... ] *) procedure TForm1.Button1Click(Sender: TObject); function MyFindValues(const AValue: TJSONObject; const AKey: string): string; var LJSONValue: TJSONValue; begin result := ''; // if (AValue <> nil) then begin LJSONValue := AValue.FindValue(AKey); // if (LJSONValue <> nil) then result := AKey + '=' + LJSONValue.ToString; // if another array... needs other approach! end; end; var LJSONValue: TJSONValue; LJSONArr : TJSONArray; begin Memo1.Lines.LoadFromFile('..\..\MyJSON.txt'); Memo2.Text := ''; // LJSONValue := nil; // try try LJSONValue := TJSONObject.ParseJSONValue(Memo1.Text); // or TJSONArray directly! // if (LJSONValue <> nil) then begin LJSONArr := TJSONArray(LJSONValue); // if (LJSONArr <> nil) then for var A in LJSONArr do begin Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'restaurant_id')); Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'name')); Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'cuisine')); Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'borough')); Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'address')); // array = sub-table = needs more iterations to extract items... Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'grades')); // array = sub-table end; end; except on E: Exception do // generic ShowMessage(E.Message); end; finally LJSONValue.Free; end; end; initialization ReportMemoryLeaksOnShutdown := true; end. -
Send message frmo VCL app to another machine in lan
programmerdelphi2k replied to mikak's topic in General Help
Malcolm Groves explains with details about Tethering usage to create your apps communications on network (be the same or not), I think that solve your problem! At end, the TCP/UDP is used on behind scenes! and Observer Pattern is used to subscribes all members! http://www.malcolmgroves.com/blog/?p=1842 -
Conversion between Markdown and HTML
programmerdelphi2k replied to John Kouraklis's topic in General Help
did you know? (I dont use it) https://convertio.co/document-converter/ https://developers.convertio.co/ -
tjsoniterator How to fill TListViewItem using TJsonIterator ?
programmerdelphi2k replied to wright's topic in Network, Cloud and Web
try this StackOverFlow: some like this, maybe a "recursive" function .... https://stackoverflow.com/questions/46534011/delphi-parse-json-array-or-array function getData(JsonString: String; User: String; Field: String): String; var JSonValue: TJSonValue; JsonArray: TJSONArray; ArrayElement: TJSonValue; FoundValue: TJSonValue; begin Result :=''; // create TJSonObject from string JsonValue := TJSonObject.ParseJSONValue(JsonString); // get the array JsonArray := JsonValue as TJSONArray; // iterate the array for ArrayElement in JsonArray do begin FoundValue := ArrayElement.FindValue(User); if FoundValue <> nil then begin Result := ArrayElement.GetValue<string>(User + '.' + Field); break; end; end; end; -
tjsoniterator How to fill TListViewItem using TJsonIterator ?
programmerdelphi2k replied to wright's topic in Network, Cloud and Web
first you need organize your JSON text: many "arrays with sub-arrays..." your JSON needs some adjusts...: [ {...}, {...}, ... ] -
Form ObjectAtPoint() does not working or "me" not working :)
programmerdelphi2k replied to programmerdelphi2k's topic in FMX
I can not "have" HitTest defined, at all! I need pass over it- 8 replies
-
- fmx
- objectatpoint
-
(and 2 more)
Tagged with:
-
Form ObjectAtPoint() does not working or "me" not working :)
programmerdelphi2k replied to programmerdelphi2k's topic in FMX
nope!- 8 replies
-
- fmx
- objectatpoint
-
(and 2 more)
Tagged with:
-
uses uDMMain; var MyDM_on_Init_Section: TMyDataModule; // You wouldn't need this variable if you were going to use the global var "MyDataModule" procedure TForm1.FormCreate(Sender: TObject); begin // using global "var" on "uDMMain.pas" MyDataModule := TMyDataModule.Create(nil); // called: 2º // if (MyDM_on_Init_Section <> nil) then // accessing objects from "MyDM_on_Init_Section" MyDM_on_Init_Section.FDConnection1.LoginPrompt := false; end; procedure TForm1.FormDestroy(Sender: TObject); begin // try comment this lines... MyDataModule.Free; // called: 3º MyDataModule := nil; // avoid "AV" on "finalization section"... "Free" dont release pendent pointers on memory! end; initialization MyDM_on_Init_Section := TMyDataModule.Create(nil); // called: 1º finalization MyDM_on_Init_Section.Free; // called: 4º // if (MyDataModule <> nil) then // if on memory and "valid object"... MyDataModule.FDConnection1.LoginPrompt := false;
-
Debug works only when a "code" do sense, or be, the "code" is used in any place on project. Else, the compiler ignore it!
-
Hi @Dave Nottage as always... nobody try "the basic": an empty project deployed avoid so much doubts!!!
-
Form ObjectAtPoint() does not working or "me" not working :)
programmerdelphi2k replied to programmerdelphi2k's topic in FMX
- 8 replies
-
- fmx
- objectatpoint
-
(and 2 more)
Tagged with:
-
New Installation of Rad Studio 10.2 (Tokyo)
programmerdelphi2k replied to fe-hre's topic in General Help
RAD backup doesnt works, because your license will be verifyed by Embarcadero when online (maybe some checksum), and, YOU will need backup your REGISTRY with all Embarcadero keys in HCU and HLM!!! then, in your new RAD "re-install/COPY" your MSWindows Registry should receive old-registry-Embarcadero keys backup-ed! -> do it run? now, if using a VM to install your RAD, you can do it! but maybe you have some problem with mobile development/external hardware...- 22 replies
-
verify if any component is trying access your database - verify DB connection if true on design-time or in some place? it's preferable dont create all forms/datamodules automatically! try create it after main-form on memory!
-
New Installation of Rad Studio 10.2 (Tokyo)
programmerdelphi2k replied to fe-hre's topic in General Help
If your license is allowed have +1 installation, then you can try "delete" all Embarcadero folders to start from begin! -- it's better than reinstall MSWindows! 🙂 uninstall it at first, of course! RAD Studio store your license info and others in c:\ProgramData\Embarcadero (including 3 folders with names using "GUID" format) - normally, 3 first subfolders on \ProgramData in "c:\User\<<win user>>\AppData\Local" and "\Roamming" you'll have the IDE config files after your first load It's preferable install it using ISO to avoid any problem with Embarcadero connection! reserve some like "60GB - 100GB" to installation, after this, you can delete all residual files!- 22 replies
-
D11.2 + FireDAC + MySQL 64 bit not working
programmerdelphi2k replied to Sonjli's topic in Databases
if libcrypto-1_1-x64.dll, libssl-1_1-x64.dll not found show this msg! https://docwiki.embarcadero.com/RADStudio/Sydney/en/Connect_to_MySQL_Server_(FireDAC) -
D11.2 + FireDAC + MySQL 64 bit not working
programmerdelphi2k replied to Sonjli's topic in Databases
my test using MySQL 8.0.26 Community + RAD 11.2 Alexandria + FireDAC + LibMySQL.dll (libcrypto-1_1-x64.dll, libssl-1_1-x64.dll) (64bits) + App in 64bits NONE DLL on \Windows\SystemXXXX NONE PATH MySQL defined NONE FDDrivers.ini definition! just default by RAD [FDDrivers.ini] Encoding=UTF8 LibMySQL.DLL, libcrypto-1_1-x64.dll, libssl-1_1-x64.dll on exe folder procedure TForm1.Button1Click(Sender: TObject); begin FDPhysMySQLDriverLink1.VendorLib := 'libmysql.dll'; // FDConnection1.Open; if FDConnection1.Connected then begin FDQuery1.Open('select * from customers'); end else ShowMessage('not connected') end; Tip: RAD Studio IDE works in 32-bit, that is why it cannot connect with MySQL 8.0, wich is only available in 64-bit. To avoid this connection issue you can use MySQL 5.7.29, which is the most recent 32-bit version of MySQL. -
comparing Earth x Mars x Sun: Earth: blue Mars: red Sun: yellow
-
Is there a program for Converting from VCL to FMX?
programmerdelphi2k replied to JohnLM's topic in Delphi IDE and APIs
in the end, basically, all will be a "find(s) and replace(s)"... and YOU'll have that code it! -
maybe was better forget Delphi and go back to Basic on CP500? Not? 😋
-
Is there a program for Converting from VCL to FMX?
programmerdelphi2k replied to JohnLM's topic in Delphi IDE and APIs
in fact, not! because exists many differences between it. then, you always will have code it. in RAD you can find "reFind.exe" that allow "replace" occurrences by other, but you need create your script manually -
you cannot use TListIem.Create in FMX. You should use var LVItem: TListViewItem; begin LVItem := ListView1.Items.Add; LVItem.Text := 'hello'; end;
-
Vcl.ComCtrls; type TForm1 = class(TForm) ListView1: TListView; procedure FormCreate(Sender: TObject); ... implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var MyListItem: TListItem; // VCL begin MyListItem := ListView1.Items.Add; MyListItem.Caption := 'hello'; end; end.