jon_bondy
Members-
Content Count
15 -
Joined
-
Last visited
Everything posted by jon_bondy
-
This code was working in Android before I was forced to upgrade to Delphi10.3 Community Edition. I open some text files and display them in a memo. Sometimes the user selects a file from the list of files in the Documents folder. Sometimes the user opens the "next" file in the Documents folder. When the user opens the "next" file in the Documents folder, the file displays correctly, at the top of the file. When the user opens a file by selecting it from the list, the file scrolls all the way to the bottom. I have tried everything that I can think of to force the memo to go to the top, to no avail. I use the same procedure to open all files in all cases. It consists of fName := ASelectedItem; ScrollOff; Memo1.Lines.LoadFromFile(fName); Memo1.ScrollToTop; Memo1.GoToTextBegin; Memo1.SetFocus; where ASelectedItem is passed in as a string parameter, and ScrollOff turns off an automatic scrolling feature that I implemented and almost never use. I realize that seeing only this code fragment it is difficult for anyone to figure out what I've done wrong, but I hope that the hint that I transitioned from 10.2 to 10.3 may suggest something to someone who is more experienced in these two releases than I am (or experienced with the underlying Android SDKs). I have to say that being forced to upgrade to 10.3 has cost me an enormous amount of time while not changing any useful functions of which I am aware. If someone can point me to documentation about how to take a snapshot of my project so that I can upload it, I will do so. Thanks. Jon
-
@Dave Nottage: Thanks for your help! Your suggestion fixed the problem, but the program behavior remains mysterious. Suppose that my TMemo already is loaded with song Fred. I then try to Open song Joan. After I select Joan, the selection screen clears and I see the leftover Fred (good). Then Fred scrolls all the way to the bottom (mysterious but harmless). Then Joan loads properly at the top. I don't understand what is going on, but at least the app is working again. Thanks again! Jon
-
Bump...
-
Stranger and stranger. I have disabled all timers (which I use for scrolling) and the problems still persist. I noticed that the files first appear in the correct position, scrolled to the top, and then scroll down (instantly) after about 1/2 second. It is as if a timer went off after 1/2 second, but there are no timers to do the scrolling. I've also noticed that some files scroll to the end while others just scroll 1/2 of a line height. Yeah. Right. This is reproducible, as if the TMemo is displaying different files differently based on content or file name. Clearly, I cannot have written such complex code by accident and then not noticed it while debugging recently. And, it was working just fine a month ago. Of course, by now, with all of my flailing, the code is not precisely as it was a month ago. I have attached a ZIP with some files. I hope I have provided the right files for someone to compile my program: if not, please ask for what you need. I have also included two TXT files that you should put in your Documents folder. Those files should be visible if you tap on the Open button. If I open the Jolene file here, it scrolls to the end; if I open the Honky Tonk Blues file here, it scrolls down 1/2 of a line. When I tap on Prev or Next, the files open without scrolling. The program was written as a quick hack. The "buttons" just look like words across the top of the screen. JLBPrompter.zip
-
@Lars Fosdal: Thanks for the suggestion. Does SendMessage work on Android? When I try to use that procedure, it is undefined. Does it live in some module that I need to Use?
-
If I have posted this in the wrong place, I welcome moving it to the appropriate location.
-
Well. Maybe here is a clue. When I perform the "next" function, the memo APPEARS to be correctly positioned. But if I tap somewhere in the text, suddenly it scrolls to the end, as if it was really at the end the whole time. None of this is how it behaved a month or two ago, before I was forced to upgrade Delphi. Puzzling and frustrating.
-
I tried the order you recommended and the behavior does not change. The app is actually very minimalist, except for a file selector that I found somewhere. That is a separate module, with a callback routine which is invoked when the file is selected. When the LoadFile() procedure is called as a call back, the bad scrolling behavior occurs; when it is called directly, with a file name, the file is correctly positioned in the memo.
-
Thanks for the suggestion. I disabled the automatic scrolling and the problem still persists.
-
I wrote an image viewer/processor years ago, and use it for all of my image viewing. Recently, iPhone friends have started sending me HEIC formatted pictures, which I cannot process with my software. I've looked around for a free HEIC library (as I did with JPG and PNG in the past) but no joy. Anyone know of a freeware HEIC library for Delphi Pascal?
-
Thanks, everyone, for your help! I just need this for my personal program, not a commercial program; and I would give it away if someone wanted a copy. It is unfortunate, but not surprising, that Apple would choose a default format that is not open source...
-
Cannot get correct path to Documents folder on Android using Delphi 10.3
jon_bondy posted a topic in RTL and Delphi Object Pascal
When I use this code path := system.IOUtils.TPath.GetDocumentsPath; using Delphi 10.3 I get the following value for "path": /data/user/0/com.embarcadero.<my app name>/files This makes no sense to me at all. I want to be able to read the contents of the Documents folder, not read and write into a sandboxed folder. All of this was working under 10.2 Tokyo, but no longer works as it once did. I can see the Documents folder using a variety of tools on the Android device. One tool claims the path is '/Documents'. Another claims the path is '/storage/emulated/0/Documents'. Neither path works when used in my Delphi Android application. I can no longer see the files in the Documents folder. I believe that /'storage/emulated/legacy/Documents' worked at one point, but it no longer works (on the same Android device). -
Cannot get correct path to Documents folder on Android using Delphi 10.3
jon_bondy replied to jon_bondy's topic in RTL and Delphi Object Pascal
Implementing the permissions code did the trick. One thing that puzzled me was that the code without permissions was working on another Android device, but not this one. Thanks everyone for your help! -
Cannot get correct path to Documents folder on Android using Delphi 10.3
jon_bondy replied to jon_bondy's topic in RTL and Delphi Object Pascal
Thanks, Cristian. I am using the community license for Delphi, so I can no longer use 10.2, and must use 10.3. I would have been happy to stick with 10.2, but Embarcadero decided otherwise. I will go play with Permissions. Thanks to all of you for your help. -
Cannot get correct path to Documents folder on Android using Delphi 10.3
jon_bondy replied to jon_bondy's topic in RTL and Delphi Object Pascal
Dave: Thanks so much for your help! I tried using TPath.GetSharedDocumentsPath, but that resolves to /storage/emulated/0/Documents, which is empty. No files are visible, even though I know that the Documents folder contains about 100 files. These files have always been visible in the past. This is the code that I'm currently using to show me the path: path := TPath.GetSharedDocumentsPath; ShowMessage(path); When I say "not working" I mean "my program should be able to see all of the documents in the Documents folder that everyone else can see, and none of the approaches let me see any of the documents that I know are present on the device." As I said, this software was working fine (the documents were appearing in the list) and now suddenly no documents are visible. I never needed to deal with permissions before (but I am reading, not writing, to the Documents folder) so I don't know why I would start needing to do so now. The main mystery for me is why it worked and then suddenly did not work. Jon