-
Content Count
1406 -
Joined
-
Last visited
-
Days Won
22
Everything posted by programmerdelphi2k
-
MSBuild - set library paths without touching IDE options
programmerdelphi2k replied to Fr0sT.Brutal's topic in General Help
Note: when you "build" with "Use MSBuild..." on project, you'll have a file .CMDS with all properties necessary. then, I think that it's not necessary add it on command-line. You need just have in your "output EXE/DLL" folder of course, you can create this file manually! = <<project name>>.CMDS in Project1.DPROJ is added: <DCC_UseMSBuildExternally>true</DCC_UseMSBuildExternally> <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/> http://blog.blong.com/2017/10/delphi-buildinstall-to-android-from.html -
Unofficial Delphi LSP fix for Delphi 11.2
programmerdelphi2k replied to Stano's topic in General Help
this time, better scan it with your Antivirus, BEFORE USE IT! 🙄 -
MSBuild - set library paths without touching IDE options
programmerdelphi2k replied to Fr0sT.Brutal's topic in General Help
hi @Fr0sT.Brutal Sorry, I dont xpert in MSBuild ok, but you can try this way: testing with a project default: 1 form main, 1 other form define your options in your project in your project, if you dont, check the option: "Use MSBuild externally to compile" [x] now, use "BUILD" to build all files dependences (the most important will be "xxxxx.CMDS" file all another you can delete after!) not necessary at all now, you can see in your project folder a new file "<<project name>>.CMDS" in your "output directory" defined on project-options in my case, was copied the "RSVARS.bat" (from RAD \bin folder) file to the project directory to create the Delphi environment variables run it // this was important on task now, using "MSBuild.exe" appropriated, (in my case C:\Windows\Microsoft.NET\Framework\v4.0.30319>" version just executed: msbuild.exe on project folder, and the project will be created. folder opened on CMD console cd "C:\Windows\Microsoft.NET\Framework\v3.5>" or "C:\Windows\Microsoft.NET\Framework\v4.0.30319>" --- what "MSBuild.exe" you use? cd "D:\RADStudioTests\RADRX112Tests\__TEMP" command-lines on CMD console ( I'm in "d:" drive) c:msbuild.exe in my project I have defined Output directory = .\ExeOutput Unit output directory = .\DCUOutput DCP output directory = .\DCPOutput Use MSBuild externally to compile [x] -
How to intercept the bluetooth joystick button press when the screen is locked.
programmerdelphi2k replied to sneg74ok's topic in Cross-platform
if you screen is "locked", then, you'll need allow any key from external-keyboard/joystick unlock it/wake-up. In Android is possible add a Bluetooth-Device in: Setting-> Security -> Smart Lock -> Trusted Devices... -
hi @sjordi FMX: I have tested on "MSWindows - mouse" and "Android 11 - finger" and I can delete the item using "Left or Rigth" direction. Note: if "deleting by code" needs hide the delete button on next item showed on ListView after item-deleted! type TForm1 = class(TForm) ListView1: TListView; GestureManager1: TGestureManager; .... var LastLI: TListItem = nil; // to avoid many times in same item... procedure TForm1.FormCreate(Sender: TObject); begin for var i: integer := 0 to 9 do ListView1.Items.Add.Text := 'Item' + i.ToString; end; procedure TForm1.ListView1Gesture(Sender: TObject; const EventInfo: TGestureEventInfo; var Handled: Boolean); var LI: TListItem; begin Handled := true; // YOU on control! // //if GestureToIdent(EventInfo.GestureID, s) then Memo1.Lines.Add(EventInfo.GestureID.ToString + '=' + s); // case EventInfo.GestureID of sgiLeft, sgiRight: begin // ... delete it? or let the user click on "Delete button" LI := ListView1.Selected; // if (LI <> nil) and (LI <> LastLI) then begin ListView1.Items.Delete(LI.Index); // or other action... // LastLI := LI; end; end; end;
-
[Problem] Convert DB from unidac sqlite to FD sqlite
programmerdelphi2k replied to kabiri's topic in FMX
well, if you know the "reason", then this way would be the better way to solve this problem. but if dont... if you can open in UniDAC usage, then, try UniDAC export /import manager Tutorial to CSV export https://www.sqlitetutorial.net/sqlite-export-csv/ or, you can use any other "DB Manager" to export it (datas) your database SQLite to any DB used by FireDAC -
hi @JimKueneman you can try this way: implementation {$R *.fmx} uses System.Generics.Collections; procedure TForm1.FormCreate(Sender: TObject); var LVI: TListViewItem; begin for var i: integer := 0 to 30 do // for tests... begin LVI := ListView1.Items.Add; LVI.Text := 'Item' + i.ToString; end; end; procedure TForm1.ListView1SearchChange(Sender: TObject); var LText: string; begin for var i in ListView1.Items.UnfilteredItems do if i is TListViewItem then LText := LText + TListViewItem(i).Text + slinebreak; // Memo1.Text := LText; end;
-
An unexpected error occurred code maintenance - A1000012
programmerdelphi2k replied to Abhishek Karn's topic in General Help
-
Close application during form create??
programmerdelphi2k replied to Ian Branch's topic in General Help
as said Melander, and adding... PostQuitMessage( 0 ) it will close the app in any place on project! uses Unit2; procedure TForm1.FormCreate(Sender: TObject); begin PostQuitMessage(0); // quit end; procedure TForm1.Button1Click(Sender: TObject); begin Form2 := TForm2.Create(self); end; // ----- Form2 ---- {$R *.dfm} procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; // to avoid "memory leaks" when using "TForm2.Create(self);", else, try another approach! end; procedure TForm2.FormCreate(Sender: TObject); begin PostQuitMessage(0); // close the app same in this place! end; -
How do I check for empty rows in a string grid?
programmerdelphi2k replied to PrimeMinister's topic in General Help
it would can be some like this: It's never too late... then implementation {$R *.dfm} type TMyHack = class(TStringGrid); // to access "DeleteRow()" function MyHowManyRowsToDelete(const AStringGrid: TStringGrid): TArray<integer>; var LRowText: string; begin result := []; // for var i: integer := 0 to (AStringGrid.RowCount - 1) do begin LRowText := ''; // for var j: integer := 0 to (AStringGrid.ColCount - 1) do begin LRowText := LRowText + AStringGrid.Cells[j, i].Trim; // if (LRowText <> '') then // to avoid still... break; end; // if LRowText.Trim = '' then // all columns is empty = row empty result := result + [i]; end; end; procedure TForm1.BtnNormalizeRowsClick(Sender: TObject); // the main idea var LRowsToDelete : TArray<integer>; LCurrentRowPos: integer; begin // in StringGrid/Grid all cells is a string, normally! // // VisibleRowCount or RowCount = ??? = you decide! // StringGrid1.FixedRows = what to do with it? // LCurrentRowPos := StringGrid1.Row; // LRowsToDelete := MyHowManyRowsToDelete(StringGrid1); // if (Length(LRowsToDelete) = StringGrid1.RowCount) then // all rows empty begin StringGrid1.RowCount := 0; exit; end; // for var i: integer := high(LRowsToDelete) downto 0 do // last to first... TMyHack(StringGrid1).DeleteRow(LRowsToDelete[i]); // remove it // if (LCurrentRowPos > (StringGrid1.RowCount - 1)) then StringGrid1.Row := StringGrid1.RowCount - 1 else StringGrid1.Row := LCurrentRowPos; end;- 7 replies
-
- delphi
- stringgrid
-
(and 3 more)
Tagged with:
-
First, DB actions + Thread is a complicated subject! DB it does not provide a "feedback" to the user (developer) so that he can follow the current process... Therefore, such actions are very fast, as there is no update on the screen. On the other hand, this would not be desired, since the purpose of SQL actions is to promote "task execution" and not "task follow-up". Second, as the actions in a DB are performed in a secondary plane (out of the user's reach), using a thread can be complicated due to the non-synchronism between the two actions: doing something in the DB and executing the thread. So, what you could do is "give the impression that the progressbar is being fed by the SQL responses", that is, do a "fake-updates on the progressbar". NOTE: all updates must be done using "Synchronize" or "Queue" procedure of thread!
-
ms access error message - there is no object in this control
programmerdelphi2k replied to JohnLM's topic in General Help
So, to remove any doubts, it only remains to test the same DB Access file on another PC. If it opens then most likely some DLL/OCX has been replaced by RAD Studio... using your report as a starting point. One attempt would be to find out which one, and copy it from another PC. However, you could fix MSAcces and break RAD Studio... Got it? MS Access uses OCX and DLL files. -
ms access error message - there is no object in this control
programmerdelphi2k replied to JohnLM's topic in General Help
have you tryed "delete" control and add again in your DB Access? -- perhaps a "ActiveX/OCX/DLL" was replaces on system folder (in old MS-APps was a common way install many "same"-libraries in many places! -
look this sample using a Dictionary: unit uMyClass; interface uses System.SysUtils, System.Classes, System.Generics.Collections; type TMySHPDataValues = string; TMyDic = TDictionary<string, TMySHPDataValues>; // TMyClass = class // not inherited from other... private FMyFileSHPwithData: TMyDic; // function GetMyCountFiles: integer; function GetMyFileNames: TArray<string>; public constructor Create; destructor Destroy; override; // procedure AddFilesAndData(const AFilename: string); procedure RemoveFilesOnList(const AFilename: string); procedure RemoveAllFilesOnList; // property MyCountFiles: integer read GetMyCountFiles; property MyFileNames: TArray<string> read GetMyFileNames; property MyFilesAndData: TMyDic read FMyFileSHPwithData; end; implementation { TMyClass } constructor TMyClass.Create; begin FMyFileSHPwithData := TMyDic.Create; // TDictionary<string, TMySHPDataValues>.Create; end; destructor TMyClass.Destroy; begin FMyFileSHPwithData.Free; // inherited; end; function TMyClass.GetMyCountFiles: integer; begin result := FMyFileSHPwithData.Count; end; function TMyClass.GetMyFileNames: TArray<string>; begin result := []; // for var F in FMyFileSHPwithData do result := result + [F.Key]; end; procedure TMyClass.RemoveFilesOnList(const AFilename: string); begin if (AFilename <> '') and (FMyFileSHPwithData.Count > 0) then FMyFileSHPwithData.Remove(AFilename); // if not exits, nothing happens! end; procedure TMyClass.RemoveAllFilesOnList; begin FMyFileSHPwithData.Clear; end; procedure TMyClass.AddFilesAndData(const AFilename: string); var MyFileContent: string; begin if (AFilename <> '') { and FileExists(AFilename) } then begin // now, you need open the file and read all content to store it on dictionary... // How are you going to do this? It depends on the content of the file... // // each file will have a content, of course!!! // // ... let's say that content is like a strings: C1, L2, A54, V100, hello, world, etc... MyFileContent := 'C1, L2, A54, V100, hello, world, etc...'; // // if already exists, just replace value FMyFileSHPwithData.AddOrSetValue(AFilename, MyFileContent); end; end; end. implementation {$R *.fmx} uses uMyClass; var MyFilesSHP: TArray<string>; var MyClass: TMyClass = nil; procedure TForm1.Button1Click(Sender: TObject); begin if (MyClass = nil) then exit; // MyClass.RemoveAllFilesOnList; // MyFilesSHP := ['file1.shp', 'file2.shp']; // for var F in MyFilesSHP do MyClass.AddFilesAndData(F); // for var F in MyClass.MyFilesAndData do Memo1.Lines.Add('File: ' + F.Key + ', Content: ' + F.Value); end; procedure TForm1.Button2Click(Sender: TObject); begin if (MyClass <> nil) then Memo1.Lines.AddStrings(MyClass.MyFileNames); end; initialization ReportMemoryLeaksOnShutdown := true; MyClass := TMyClass.Create; finalization MyClass.Free; end.
-
What size (average) SHP file do you want to read in your application? What is the content of this file? Is it a binary? Is it some strings? What type of data? How many files do you need to read at any given time? 1, 2, 100, etc.?
-
you're mixing things up now! or you use your TList<string> or new way TDictionary, look my text above: TMyDataFromSHP = string; { just for show the idea } // this type is dependent of "how the data are stored into SHP file", you see? First, I dont know the file content is stored: binary, string, etc... open file, read content, store it on MyDataFromFileSHP dictionary! the content is very big, or moderated? Let's use a example: a file1.SHP have its content like a coordenates using in SVG files... then, the content is not big, can be read on memory easely! now, if you read many files SHP in same time, and all together needs a big memory volume, then, this it's not desirable, too!
-
-
try this way to store your "file names" and "data from each file: uses System.Generics.Collections; type TMyFileNames = TArray<string>; TMyDataFromSHP = string; { just for show the idea } // this type is dependent of "how the data are stored into SHP file", you see? // ... var MyFileNames : TMyFileNames; MyDataFromFileSHP: TDictionary<string, TMyDataFromSHP>; // this can replace your FFilenames=TList<string> begin // create on "Create"-class MyDataFromFileSHP := TDictionary<string, TMyDataFromSHP>.Create; // for var F in MyFileNames do MyDataFromFileSHP.Add(F, 'my data into SHP file'); // destroy it on "Destroy"-class MyDataFromFileSHP.Free; // end;
-
hi @Linuxuser1234 note that GISobj is a instance of "TGISEngine", and it dont really do nothing, in fact! try to assing your "Earth" on form where is the "3Dviewport" not in GISObj
-
A comprehensive guide to Delphi programming language functions and procedures
programmerdelphi2k replied to pouyafar's topic in VCL
Sorry, Batman! Im not "Enigma"! -
forum loading previous message when selecting [create new topic]
programmerdelphi2k replied to JohnLM's topic in General Help
in my case, in Chrome (PC), I use "clear the cache files for all period". and works! -
A comprehensive guide to Delphi programming language functions and procedures
programmerdelphi2k replied to pouyafar's topic in VCL
In the absence of experience, ask for an indulgence! I see that there are people who are so "certain of what they do" and "show themselves as owners of the truth", still fall for false promises for measly cents. "nothing yet right, now" :) -
[Problem] Sometimes when I open the form, the Gesture event does not happen
programmerdelphi2k replied to kabiri's topic in FMX
if "old layout works", then new should too. Perhaps some component is in front of another that should receive focus. The hittest is disabled, etc... -
You need to know that the SQL engine should have a "like a Callback function" so that you can interact with the data manipulation (records being manipulated). For example, with each record manipulated, "your function" would be called to execute another conditional task. On the other hand, on mobile, you should work with "threads" in the background so that the main interface remains completely free for important system tasks. Thus, you could try to create a "thread" that every moment, check what has already been done, and then update your UI. Preferably at intervals that are not very close, for example, every 5%, 10%, etc... you code is?