Jump to content

JohnLM

Members
  • Content Count

    359
  • Joined

  • Last visited

Everything posted by JohnLM

  1. I have an e-scooter that I use for riding around towns and trails. There is an app to download. However, that app does not connect to my scooter and the developer is slow to fix/resolve/respond and still does not connect. So, I would like to look into writing my own app for my phone (android) to do the following: 1. track start and end times 3. track my routes - where i've been or stopped at 4. show the miles I am traveling during my ride in real-time 5. show the total miles of my ride 6. possibly show speed (via calculation) and in real-time 7. eventually, to show a map of my route in real-time, and show all my stops Is this possible with Delphi 11.2 and free components/services/API's ?
  2. @ Rollo62, Hi, I am starting out slowly. But I've coded various apps on Android over the years since XE7. I am not fluent in the Permissions area, but so far in this project, I am okay with what I have working on. I ride through trails in my area, so I am using that as an opportunity to test my app in order to debug and make any necessary changes/additions.
  3. For step 2, I've added a tmemo control to hold all the data (latitude and longitude) that comes in during my travels. In addition, I added to the list to include an Index counter (line # 1, 2, 3, .. 200, etc.) and a time stamp entry for each lat/long value, thus. . . 001 - 5:06:03 PM - 0.0101-nnn : 0.0101-nnn 002 - 5:06:09 PM - 0.0102-nnn : 0.0102-nnn 003 - 5:06:10 PM - 0.0102-nnn : 0.0103-nnn I just need to find a way to plug those values for the lat/long into a map somehow and have it plot my previous travel route onto a map in my app. Next, I will research how to do this.
  4. After some searching, I found and tried various code snippets dating back a few years but they did not work because they were missing the code snippets for handling Permissions on Android or at least my phone's version of Android 12. Then, I decided to search around in my samples folder and did find a sample called, "Location" in the C:\Users\Public\Documents\Embarcadero\Studio\22.0\Samples\Object Pascal\Mobile Snippets\Location folder. I compiled it into my Android phone and it work right from the start. Thanks, Embarcadero! I also found a couple of youtube videos, below, showing exactly this app in action. I believe I can complete steps 1, 2, and 6, below. 1. track start and end times 2. track my routes - where I've been or stopped at 3. show the miles I am traveling during my ride in real-time 4. show the total miles of my ride 5. possibly show speed (via calculation) and in real-time 6. eventually, to show a map of my route in real-time, and show all my stops
  5. Delphi XE7/11, VCL, win7 Hi everyone. I've got a problem here. Because of the angle that I have to have my laptop screen at, the image when playing videos is too dark. I can barely make it out. I've learned that I can adjust the color brightness level in windows. I may also need to custom change the other colors (contrast gamma hue sat) as well, and then reset them back to standard when I'm not playing videos from youtube. The tool I used to adjust the Brightness level is the Intel control panel applet, below. However, it is difficult to bring up when I need it. And I only just discovered it today. I used to just sit up higher in my chair, which was terrible. If this is possible, how can I do this in Delphi? TIA
  6. Delphi 11, win7, office 2010, ms access I did not know anywhere else to post this and thought it best here. I use Office 2010, and when I open an Access database and proceed to open a text file for importing as a new Table or Linked source, it fails with the message "there is no object in this control" Also, when I proceed to open the Linked Table Manager, it also fails with the same message. After some time thinking about, and how it might have happened (I initially thought that Office got corrupt) I came to the conclusion that this happened when I installed Delphi 11.2 Alexandria because it uses the new Edge Browser components/dll's, etc., and that had to get installed which it installed, I think. Either way, I have to keep that installed in order to use Delphi 11 and/or some of the components. They appear to be necessary, so I'm stuck. It appears that I have lost some functionality in Access, like the above-mentioned, which I need and use regularly. Note, I use MS Access every day on this laptop. Does anyone know about this and how I can resolve that error message to get Access working correctly again ?
  7. RESOLVED !! I resolved it by re-installing office 2010. I was searching around for the install repair feature because I thought it would have that feature but I couldn't find one. I had found old install directory still around and hit the setup.exe app. Went through the product key/activation process with success. The old link in the pop-up dialog box still works in this version. Anyway. The Import and Linked Table Manager features are now working again!
  8. Unfortunately, that test can not work because it's not a single .mdb / .accdb file, its all of them. Even new files I create suffer the same fate. It is definitely MS Access on this laptop.
  9. No form in my Access db. This occurs inside the IDE of Access. I've been using Access (office products) since 1998, and never had this problem. I have no clue exactly what could have caused it, in terms of files and things. I use Access every day, but I haven't the need to import since early November/2022. So, no way to track exactly when this occurred except that it had to be when I installed Delphi 11 in mid Nov/2022. Today, I needed to import a fresh text (csv) file and that's when I discovered the problem.
  10. I have a problem with this forum. Whenever I go into some forums, like the General Help section and try to start a new topic, I get residuals of a previous topics post. I cannot figure out how to resolve it. It just keeps posting the same info/text in the body section. Can an admin help me resolve this? I need to post a new topic and can't. Thank you. Please ignore the junk below, This is what keeps auto-filling in when I start a new topic. . . . . win7, d11.2, vcl, for/to loop for i:=0 to 10 step 2 do begin // ...process... // end; I use to do this in delphi 6 in various projects. I never had problems with it, and I need to use it again, but this time in Delphi 11 but it is not working. Same for XE7. I believe something has changed, maybe a compiler directive switch, you know, {$step on/off} or something. I know I can do it in other ways, but in this case its easier for me to visualize in my head the various things How do I turn it on?
  11. ha-harg!! I found it, the answer.., below. Now that I think about it, it was because I started a new topic on for/step/looping (because the STEP part was not working in XE7 and D11 -- I guess its no longer supported nor recommended) and then I decided not to post it because I found another way using a simple custom counter that worked for my needs. Anyway. Not sure how I ended that post. I thought I had clicked [cancel] or just closed the window, but can't remember now, and it doesn't matter. Just click on the clear editor link and it will clear the window. Problem solved! Thank you all for chiming in, appreciated.
  12. I'm trying really hard to figure this message out, but can't. What part of the TFDTable 'text must not be empty' that i need to fill in ? 1. I have a form with a memtable and stringgrid on left side of form. 2. Also have a dbgrid with (con, table, query, datasource) components on right side of form. 3. a button to [import] the data from the stringgrid into the dbgrid. Below, is code to import data into the FDTable. I am just trying to learn how to import data through this method. Not trying to do it another method or way. So, I want to know what is the meaning and solution to the 'text must not be empty' part. I don't know what text the message is refering to when i run this code and click on the [import] button, below... thanks. procedure TForm1.btnImportClick(Sender: TObject); begin // ftable.CopyDataSet(memtable, [coStructure, coRestart, coAppend]); end; solved... (partially) - see my posts below, I explained why it was happening and what I did to resolve it. -- 12/29/2022 Friday pm
  13. From time to time, I want to be able to quickly view/verify databases that I'm working on but from another app. In XE7, I have a db app that I created for sqlite databases. I drag the file.db to the app and it opens and displays the data, but i'm having trouble making that happen when I am in delphi d11 project and its giving me the 'database is locked' error. Even when I uncheck [ ] the 'Connected' setting in Object Inspector. I seem to recall a step to set the project's app to share or something like that but can't find it or the feature to allow an open database to be shared or opened (for viewing only) from another app. Is this still possible, and how ?
  14. The solution I found (through trial and error) through the steps below, works. In the fdquery->SQL I added the following: drop table if exists tblBarcodes; create table if not exists tblBarcodes ( IDNo integer, Barcode varchar(255), isle integer, LFRT varchar(2), Row integer, Type varchar(2), Date varchar(21), Desc varchar(255) ) In my form create section, I have this bit of code: var DATABASE_FILE: string; begin DATABASE_FILE := TPath.Combine(TPath.GetDocumentsPath, 'mydb.db'); DATABASE_FILE := 'f:\datasets\mydb.db'; // <-- rem this line out when compiling over to android. <-- Con.Params.Clear; Con.Params.Add('DriverID=SQLite'); Con.Params.Add('Database=' + DATABASE_FILE); //DATABASE_FILE); con.Params.Add('create database'+database_file); Con.ResourceOptions.DefaultParamType := ptOutput; Con.Connected := True; In my [import] tbutton, I have following code: procedure TForm1.btnImportClick(Sender: TObject); begin // import the database into the second grid for review. qry.Close; qry.data := mtable.Data; qry.open; end; Note, the second grid is a dbgrid. Once I convert this portion of code over to the FMX platform (and then Android) the grid will be a stringgrid. The left side grid is the scanned barcodes, the right side grid is the copied grid/contents from the left side grid. Thus, while I debug my actual mobile barcode scanner app (at my job site), I will be running various scanning tests. So, I will be creating and deleting a number of times the contents in the left side grid, and sometimes I may be import it to right side grid, and then posibly save it out to an sqlite db for further review. Note, I have not tested it for mobile. But I plan to soon.
  15. And, by the way, I found the solution, just before you posted before my previous post above.
  16. Not quite. The goal was to have a stringgrid and populate it with barcodes that I would scan with my smartphone (android). Then, if I need the data finalized (stored) then I would export it out to a sqlite database on the phone. But first, I would need to visualize the data in some similar grid. And if I like it, I would [save] to a sqlite db on the phone. I might want to edit the data before I export it out, so the second grid would serve that purpose. Yes, I know, I could and should do it in one table/grid but I will be doing a lot of what-ifs and not needing to export or update data in real-time. I feel, in my opinion, that this is my prefered route for this project, until I decide otherwise.., this will do.
  17. After some more investigating, it seems that which ever component I use, (fdquery or fdtable), I have the have its SQL text filled out, as in something like "select * from tblBarcodes" for instance. So, the CopyDataSet(memtable, [coStructure, coRestart, coAppend]) feature is not compatible with the TFDMemTable in some way. I already know about and how to use batchmove and other methods for this process above. I was simply trying the copydataset() to see how that works because I've read about it many times and being in this particular case/situation I thought I would try it out. So, working with the TMemTable and FDQuery/FDTable together, is not a good idea for any projects then, if you can't copy from it, the table structure, etc., if I want to then create a actual database file, i.e., SQLite db.
  18. Win7, D11.2, FMX app, using TStringGrid and FireDAC and SQLite I was wondering, is it possible to make the TStringGrid have a drag or moveable rows feature? In a barcode app that I am working on, there will be times when I might want to reorient some of the rows that I scan barcodes off of products. I have a [delete] tbutton feature to delete rows. When I do this, I will resync the line numbers only. So, say I delete some rows and/or want to move one or more rows, the line number order will be out of sync. Sorting them shouldn't be a problem for just that column, while the remaining columns will stay in the same order. I can re-sort just the [Line Number] column. Back to the drag/move rows.. Methods: 1) Because my S10+ phone is so small, I use a pen for it most of the time. That is what I will use to move the rows up/down. So, I'd like to be able to drag rows that way. But if it is not possible, then 2) be able to move rows up/down using two tbuttons for the [up] and [down] on the form instead. What do you guys think? Is there a way to make this happen for the TStringGrid component?
  19. I will have a look at this later. I'm trying to work out another unrelated issue that came up in and can't seem to get it working. As always, thanks for your response.
  20. I've been busy in several things that kept me busy. Life stuff. Anyway. I wanted to thank you all for all the info on this. I will read through it again some more, thanks.
  21. win7, d11.2, vcl, firedac, sqlite with dbgrid I initially tried with the batchmove sample but that was too confusing and complicated. I thought it would be a simple and quick method to learn, but I was wrong. Then, I searched a few ideas from google and am now trying a variation of one in the example described below. I am trying to learn how to read from text files using FireDAC, into a DBGrid. Once imported, I'd like to be able to view the results first, then process it if necessary into an SQLite db. Later, I will add file-drop capability so that i can quickly drag files into the app. The first problem is, I will usually not know the fieldnames at first, or there won't be any. So I'm not sure how to handle that. The second problem is missing a tablename to give the dataset (if using a query). So, if I run the app at first, without knowing the fieldnames, I get an error about missing fieldnames. However, if I manually add them in using the following steps below.. 1. select the [TextRead1] 2. double-click the ">DataDef" property 3. and double-click the Fields "..." and manually add the fields ..then, when I run the app again, I will get the error: "SQl table not defined" Code for the [ImportText] button. procedure TForm1.btnImportTextClick(Sender: TObject); begin if od1.Execute then if od1.filename <> null then begin TextReader1.FileName := od1.FileName; try ImportFromTextBatch.Execute; qry.Close; qry.Open; except on e: exception do showmessage(E.Message); end; end; end; So, I'm close, but not there just yet. What am I missing to get the fieldnames automatically and a tablename set up for a DBGrid and SQLite database?
  22. Update.. solved! Alright, I finally got it. Thanks to your suggestion, and reading some of your code (the snippet below showed me the answer), I was able to work out the solution at this junction. Part of the issue/problem was with how I was linking the datasource and memtable, and I had to remove some components and edit out the code for the query, and change some properties/values. But regarding the datasource and memtable, after a few hours, I finally realized that I had them reversed if that makes any sense. You must choose the proper path for these two components' datasource linking or else you may get a "circular reference" error sometimes. I will keep your code for future reference. Thank you for your help! DataSource1.DataSet := FDMemTable1; DBGrid1.DataSource := DataSource1;
  23. Win7, D11.2, FMX app, using TStringGrid and FireDAC and SQLite In a near-perfect working database, it should never happen, but it could happen elsewhere, and since I have the issue now, I would like to know how to resolve this. I was doing some what-if scenarios and came upon this issue. I searched around here and elsewhere on the internet but I can not find the answer. In this scenario, I was adding a new record, which has an auto-increment field in this test database, IDNo -- ('IDNo INTEGER NOT NULL PRIMARY KEY,'). And it generated an error. Of course I understand why this happened, and can later figure out a method to avoid it from happening. But for now, i need to know how to resolve the "closed dataset" issue because I can't see the data any longer. I've tried closing the Query, and reopening it. And tried closing the Connection and reopening it too. But they are not working. When a database or dataset closes, how do I re-open it through code so that I can see the data again in the StringGrid?
  24. Win7, D11.2, FMX app, using TStringGrid and FireDAC I am using a very basic SQLite database with one table and learning how to do various things with it before I start the real project. I would like to be able to delete a row using two different methods. A) at current row position - as in when user selects a place in the tstringgrid B) at the last row (or record) position in the list in the tstringgrid I don't want to delete the Database, nor the Table. I just want to delete the last row, or the current row that I am in, depending on which "delete" method I choose at the time, and have my TStringGrid update to show it. On my form, I have two delete buttons: [DelCurRow] and [DelLastRow] For [DelCurRow], I can get the selected row with sg1CellClick(const Column: TColumn; const Row: Integer); For [DelLastRow], I can use Qry.Last or Table.Last, I think. I've tried various scenarios with these components, and many other things to no avail: form -> Connection -> Table -> [delete] form -> connection -> Table -> Query -> [delete] form -> connection -> Query -> [delete] The final outcomes are mostly Error messages. How do I delete the current or last row?
×