Jump to content

JohnLM

Members
  • Content Count

    218
  • Joined

  • Last visited

Everything posted by JohnLM

  1. 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.
  2. 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.
  3. 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?
  4. 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.
  5. I was wondering if there was a program or tool or whatever you want to call it, for taking a VCL project and converting its components over to an FMX project and be able to open and continue working on it in the FMX environment. I have over time been in this situation, where I start out with VCL but later decide I could use this in Android. Today I'm in that situation. I mainly have tbuttons, tmemos, tpanels, tedits, and ttabs.
  6. 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.
  7. 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?
  8. 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;
  9. 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?
  10. 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?
  11. JohnLM

    How do I handle the 'closed dataset' error ?

    Okay, that may work to prevent it from happening. And I will try that at a later time in this app. But there are other causes that will show 'closed dateset' error, and I will need to at last be able to reopen the dataset and StringGrid. The user should not have to keep closing down and rerunning an app. At least that is what I want to avoid if possible.
  12. JohnLM

    How do I handle the 'closed dataset' error ?

    I created the new record procedure to make it easier to add new UNIQUE records. And I was using that to re-create the issue in order to help resolve the 'closed dataset' issue. So, yes, the statement is correct. It can enter new records with no problem. This is an example script that I am using to post the same info into the query. It works fine as long as i keep the IDNo unique, so adding a 7 instead of the 6 would work, and so on. I am just duplicating the error to work out solving the 'closed data' issue. insert into tblBarcodes values (6, '120422', 'Q', 'abc1', '2 120422 Q abc1 desc1'); select * from tblBarcodes; So, the question remains, how do I reopen the dataset to show its contents through the StringGrid again, without having to close the app, and run it again?
  13. JohnLM

    How do I handle the 'closed dataset' error ?

    Please note, this is an FMX app, so live-bindings is utilized. And the reason I am working this as a Windows app is to speed up these kinds of issues versus if I was to start this in an Android project. For testing purposes for this db, I was manually writing the script to add the new record while in the IDE. And when the issue first came about, and to work out a resolution, I needed a way to re-create it so I can learn and fix it. So, I created a [new record] button and added the code to add the new record, so that every time I run the app and press the [new record] button, it would pop up the error. Note: [btnPostClick()) is the actual procedure, not [new record]. It's in this [new record] procedure that I am trying to work out the code to refresh the dataset/stringgrid to show what is current, below. procedure TForm1.btnPostClick(Sender: TObject); // post or add a new record. // this works. 12/4/sun begin conn.Connected:=true; // to reopen the dataset qry.Close; // most people say to close first then reopen qry.Open; // open dataset, stringgrid should now show // original code qry.FindLast; qry.SQL.Clear; qry.SQL.Assign(m1.Lines); // qry.Open; // remmed out for now, to test try/finally below // end of original code // here, trying catch the error and stop it (but it doesnt) try qry.Open; except on e : exception do ShowMessage('Cannot open tblBarcodes, error is: ' + e.message); end; end;
  14. Progress update.. Success! and Resolved! Thanks to the help here, I now have a working delete method that will do what I need. Below is what I decided to implement, crude but works. var Form1: TForm1; LSQLText: string; // SQL string for [deleting last row] LastRowValue: string; // from StringGrid . . procedure TForm1.btnDelLastRowClick(Sender: TObject); // this routine works! 12/4/sun late pm // delete last row, but is actually [current row selected in stringgrid] begin LastRowValue := sg1.Cells[sg1.Col,sg1.Row]; beep; LSQLText := Format('delete from tblBarcodes where IDNo=%s', [LastRowValue]); // do the row deletion here.. qry.SQL.Clear; //('delete from tblBarcodes where IDNO=2'); // <-- i.e., qry.SQL.Add(LSQLText+';'); qry.SQL.Add('select * from tblBarcodes;'); qry.ExecSQL; // show me the updated list conn.Connected:=true; qry.Active:=true; end; However, I now have another problem, but I will post a new topic for that. Thank you all for your responses.
  15. 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.
  16. Update.. and Success.. Sorry for the long delay. As it turned out, I had to update my smartphone's Android version from 10 to 12, and now all is working with the trial. However, I've since purchased their product.
  17. Hi. I saw that method used in other areas of my search. However, I can't us it because I don't know what the value is because I am using a barcode scanner in real-time, and the number scanned gets inserted into the db. However, as I re-read this, and ponder it in my head, I think I might be able to accomplish it somehow, by getting the data from say, the first column in the query, and feed that to the code you posted. hmm. If I go to .Last, I just have to figure out how to pull the field's content into a variable and then feed that somehow into the qry.SQL.Text;="" part.
  18. Update.. 11-19-2022 Sat 6:18pm 1. I found out that this component pack requires a 64-bit Android and be compiled for 64-bit applications. If your compiler IDE supports 64-bit platforms (i.e., Delphi 11 Alexandria supports 32/64-bit platforms for Android), the apps will compile and deploy to an Android device via the USB cable. 2. Delphi XE7 Professional only supports 32-bit compile/deployment for Android - so compiling and deploying over to Android will result in a black screen display. 3. Delphi 11 Alexandria (Professional) (I have 11.2) supports 32 and 64-bit compile/deployment for Android. For this Trial version 1.5.1.0 component, I have tested short custom-made apps to compile and deploy over to my smartphone (Android 10) under Windows 7 and Windows 10, successfully. In these tests, I only added the FNC WX camera component, and two regular TButtons (for Start camera and Stop camera event functions). And there is no black screen. All the components show as usual in any app created. However, the FNC WX's camera component does not work. There is no video/image displayed. To get this far, I had to add two files to the Libraries folder, for this package on my laptop install, as it was located in my "C:\Users\{your-computer-name}\AppData\Local\tmssoftware\trial\TMSFNCWXPack {RSXE7}\Android Support" folder, and locate and add the following two files into the Libraries section in your IDE: * JavaScriptHelper.jar * FNCWebChromeClient.jar right-click on the yellow [Libraries] folder, shown below, and select Add.. .. and add the two files mentioned above, to it. Once completed, you should see the two files when you click the down-arrow and scroll down, shown below. Create a new project, form, and add the two tbuttons and fnc wx camera component to the form. and add these two code snippets to turn on/off the camera. procedure TForm1.btnStartClick(Sender: TObject); begin cam.Stop; cam.CameraType := wctFront; // or change to wctBack cam.Start; end; procedure TForm1.btnStopClick(Sender: TObject); begin cam.Stop; end; Compile and see what happens in your final product. When I compile and deploy my version to my smartphone (Android 10), and select the Start button, I get no video/image. It is a blank white area, as seen below. I will post an update in another post if I find any additional answers or success.
  19. 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"}
  20. Update.. Great news.. after so many weeks and hours of searching and reading (and breaks, here and there), I have finally succeeded!! No more issues with SSL errors. I am now able to deploy apps using Indy v10.6.1.518 to my Galaxy S10+ smartphone (Android 10) using Delphi XE7 Professional under Windows 7 Home Prem 6 GB ram 64-bit laptop. I suffered many headaches over this. The screenshot below shows proof that I accomplished it. It is the same VCL app that I posted a screen copy of in my original post above, but this time in a redesigned FMX framework and deployed to the android 10 smartphone. I actually owe the thanks to Remy, from reading one of his posts over in StackOverFlow from 2016 through 2021. Actually, all the answers were spread out across many forums and topics. I just had to piece them all together somehow. This link, over at StatkOverFlow, https://stackoverflow.com/questions/37105600/error-could-not-load-ssl-library-on-android-with-tidhttp helped me to figure out the last piece of the missing part of many parts to get all this working. An excerpt from Remy's response near the bottom of that topic: So, thank you Remy
  21. 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.
  22. Windows 7 Home 64bit Delphi XE7 Professional update 1 with FireDAC and Mobile add-on Indy version 10.6.1.518 Android devices: (smartphone v10, and tables v4.4.4, and v4.4.2) I am having trouble trying to get these projects copied via Save-as and Save-project-as from the IDE, to another version'ized folder. When I start a project, I normally create a folder that describes the application name. Then, I create a version folder (i.e., v01, v02, ... v10, and so on) so that I can see the version of that project. This helps me to keep project apps organized, debugging, etc.. ** My steps are as follows for working with and saving a project into a new version folder: ** (this is just before I close down Delphi for the project) 1. open or create a project, E:\XE7\VCL\JasonParser\v01\JasonParser_v01.dproj 2. do work on that project. If the project is working well, I will quickly determine if that will be the final working version. If I decide, yes, then I will create a new version folder. ** Create new version folder: ** 3. Save-as (this saves the unit) thus, save into E:\XE7\VCL\JasonParser\v02\unit1.pas 4. Save-project-as, thus, save into E:\XE7\VCL\JasonParser\v02\JasonParser_v02.dproj 5. then, either I shut down Delphi or start a new project via steps 1 through 5. However, being my first time creating a project-group, I am lost as to how to copy over the whole project to a new version folder so that I can work on the project. The issue I am having is that the second project group is not carrying over. How do I fix this?
  23. To be safe and mostly headache-free, I am making a backup copy of the F: drive mem stick, and after that, I will re-image my laptop's C: drive using Reflect Macrium. This way I can restore both mediums if all else fails.
  24. @Rollo62, I didn't realize you were linking to an Indy-alternative. Anway, thank you. I have no issues on the Windows side of things when using Indy, so far. But my needs are for Android 10 and onward. And I would need an http.get() equivalent to Indy's. Once again, thanks for your suggestion.
  25. My XE7 Pro is installed on an USB-3 external F: drive and not the usual C: drive. Will that be an issue with installation? Do I need to change certain files to reflect this?
×