Jump to content

Fabian1648

Members
  • Content Count

    53
  • Joined

  • Last visited

Posts posted by Fabian1648


  1. I already use ListBox.Items.BeginUpdate and ListBox.Items.EndUpdate. This reduced the display of 1,000 ListBox items from 30 seconds to 6 seconds.

     

    As already written, what's wrong is adding one listboxitem after another in a loop. This is equivalent to an action for each item.

     

    If you assign a Listobject to the Listbox, it's a single action.

     

    I've tested the assignment method; it's immediate, but I can only do it for the main ListBox field.

     

    My question is whether it's possible to make an assignment that updates the other two ListBox fields by making a single assignment for the ListBox, or an assignment for each of the 3 fields, which would make it possible to do 3 actions at worst instead of 1000.

     


  2. Hi,

    Thank for your answer Martifan.

     

    The code is actually written in Delphi.

     

    I tested your solution and I get exactly the same time to perform the operation as my best solution (6 sec for 1 000 items!).

     

    The following operation takes far too long because  it adds one ListBoxItem after another

        for i := 0 to DataList.Count - 1 do
        begin
    
          ...
          
          ListBoxItem.StylesData['Reference.text'] := DataList[i].Definition;
          ListBoxItem.StylesData['Qty1.text'] := DataList[i].Qty1;
          ListBoxItem.StylesData['Qty2.text'] := DataList[i].Qty2;

    If I use a "Listbox.assign(ListObject)", the delay for 1 000 items goes from more than 6 sec to 500 millisec because all ListBoxItem are added in one shot. The problem is that only the field Reference of ListBoxItems is completed... 

     

    The question is .... Is it possible to fill in the other fields of a ListBoxItem using an assign function?


  3. Hi,

     

    1. If I don't use Livebindings, it's because I can't use Livebindings (the source is a dataset > I extract some columns of this dataset to display these in a visual component)

     

    2. This speed problem occurs with all visual components (Combobox, Listbox, etc...)

     

    3. I've already solved a similar problem with combobox: Dataset > Stringlist > Listbox.assign(Stringlist). For 1000 lines, the delay goes from more than 30 sec to 500 millisec!. In the case of the Listbox, I don't have just one dimension, but two: not just  lines, but lines made up of 3 distinct fields.


  4. Hi,

     

    In an Android app, I'm retrieving some data (3 columns) from a dataset and need to display it in a Listbox with 3 fields in each line.

     

    If I use the following procedure in a loop, adding one line after another, it works for about ten lines, but when it comes to displaying a hundred lines, the process is too slow.

     

    ...
     ListBox1.BeginUpdate;
    try
     for i:=0 ...
      ...
      AddListBoxItem(Listbox1,value1[i],value2[i],value3[i]);
      ...
     end;
    
    finally
     ListBox1.EndUpdate;
    end;
    
    
    //*********************
    
    
    procedure TForm1.AddListBoxItem(myListBox:TListBox;Definition, Qty1, Qty2:string);
    begin
    ...
    
      ListBoxItem:= TListBoxItem.Create(myListBox);
      ListBoxItem.Parent:= myListBox;
    
      ListBoxItem.ApplyStyleLookup;
    
      ListBoxItem.StylesData['Reference.text']:=Definition;
      ListBoxItem.StylesData['Qty1.text']:=Qty1;
      ListBoxItem.StylesData['Qty2.text']:=Qty2;
    ...
    end;

     

     

    It's much faster if the data extracted from the dataset are placed in a Stringlist and I transmit the data to the listbox in a single operation using "myListBox:=myStringList".

     

    In this case, the values are only in the 1st field of the listbox.

     

    How can I perform the same kind of operation to put the data in ListBox fields 2 and 3?


  5. To give a

    WebBrowser1.Silent := True;

    to suppress script errors is not a solution!!!!!

     

    I have the same problem with the Delphi 11.3 sample called "WebBrowser" running on Win11. It is impossible to load a website (even bing.com!!!) without these script errors.

     

    And "do not display these errors" does not prevent malfunctions of the website!!!!

     

    So I'm reactivating the question, does anyone know why the Webbrowser sample is unable to play javascripts and is there a solution? Since these are samples provided by Embarcadero itself, we shouldn't even have to ask this question 😞

     

    ---

    If anyone wonders why you insist on using delphi to display a website, I'd like to point out that the latest versions of Chrome and Edge (and maybe others) have changed their popup management, making many sites unusable without any prior announcement that I'm aware of!

     

     


  6. Hello,

     

    I use Delphi to develop applications for Android devices and I have a customer who asks that one of my Android applications be adapted to Apple i-phones.

     

    After doing some research, it seems that this is quite complicated to do:

     

    1. You need an Apple device to compile the Delphi code


    2. Then you have to register with Apple and submit the application for acceptance

     

    3. You can only distribute the app from the Apple Store


    4. Then there seems to be licensing issues to pay to Apple (the developer has to pay but also the end customer! Indeed, it seems that for professional apps, our customer who will use our app will have to pay each year a license to Apple for an app that was never created by Apple)

     


    If anyone has experience in this area, I would be happy to hear from them:

     

    - What are the minimum Apple devices required to transpose an Android app to an i-phone app?


    - What are the steps to take with Apple?


    - Is this story about the Apple license to be paid by the final customer true and what is its cost?

     

    Thanks for your help


  7. 9 hours ago, Dave Nottage said:

    Can you provide specific links?

    Does this happen with a blank app?

    1. To have specific links, just type "Delphi 10.3 Android11" in Google

     

    For instance:

    https://stackoverflow.com/questions/67453524/why-is-delphi-10-3-app-crashing-in-android-11

     

    2. Personally I haven't tried it but according to some comments on the web an empty app compiled on Delphi 10.3 crashes on Android11


  8. I give myself the answer to my question so that it can be useful to others 🙂

     

    I found in the code that handles image capture 2 problems related to the changes made by Delphi 10.4:

     

    1. A unit of the ZXing library has an error following the change of the indexing of the characters of a string (mystring[0] in Delphi10.3 becomes mystring[1] in Delphi10.4)

     

    2. The management of the .free (a .free in Delphi 10.3 which must be removed because in Delphi 10.4, the release of a parent object automatically releases its children objects

     


  9. 36 minutes ago, Hans♫ said:

    This could also be due to differences in hardware and configuration. How many devices have you tested for each Android version?

    No, I don't think it's a problem of hardware or configuration.

     

    We have tested on many devices (smartphones and tablets of different manufacturers) and we always have the same behavior.

     

    In fact, just do a search on the web and you'll find many people who have had exactly the same problem.

     

    On our side, we took the same original code (with some adaptations due to the changes brought by Delphi 10.4, for example the 1st character of a string becomes mystring[1] while before it was mystring[0]) and compiled it with Delphi 10.4.

     

    The result is? The app compiled with Delphi 10.4 works on all Android versions.

     

    So there is a problem between Delphi10.3 and Android11.

     


  10. Hi,

     

    I had an Android app developed in Delphi 10.3 that scanned barcodes via the smartphone camera and the ZXing library.

     

    After switching to Delphi 10.4, the project was able to compile without any problem but the picture taking frequently crashes: It works sometimes and often the app freezes and you have to wait for a timeout for Android to ask if you don't want to close the application (same behaviour on Android 9, 10, 11).

     

    There must have been changes in Delphi 10.4 that cause this problem.

     

    Does anyone have an idea of such a change in Delphi 10.4 that could be the cause of this problem?

     

    Thanks for your help


  11. Hi,

     

    The Android SDK provided with Delphi 10.3 included a logging system of the Android device events (launched by monitor.bat). With Delphi 10.4, the tool still exists but crashes indicating that Eclipse files are missing. With Delphi 11, this tool does not even exist anymore!

     

    How can I access the log of the Android device (internal messages of the Android device and those originating from "log.d('My error message');" added to its Delphi code?

     

    Thanks for you help


  12. Choices must be made based on the target users:

     

    1. Our apps are not intended for every country in the world. We have therefore 3 types of keyboards according to our targeted languages and geographical areas

     

    2. The "virtual keyboard" solution is not available on all Android devices, so it is not interesting unless you limit your app to some specific models.

     

    In the end, there is no magic solution. You have to make a choice according to the specific needs of your app.

     


  13. Hi,

     

    The floating keyboard is only available on some Android device models.

     

    To avoid any problem of accounting from one device to another, I no longer use virtual keyboards provided by Android. I have developed my own keyboards.

     

    When the user clicks on the object to be edited, I call an input screen consisting of a display area and keyboard keys. Advantages of the approach: 100% compatible with any Android device and keys big enough to avoid taking a magnifying glass to write something.


  14. I found the source of the problem using Android Device Monitor. the permission "record sounds" was not enabled in the project parameters of the app!

     

    In this case, Android's permissions management doesn't seem to work perfectly since the code was working sometimes.


  15. Hello,

    I'm trying to use Google's voice recognition service in an Android app but my app loses control when retrieving data.

     

    1° In the triggered event, it is not possible to process the provided answer (the app loses the hand and Android indicates the app does not answer anymore after several seconds)

    procedure TForm1.SpeechRecognition1Recognition(Sender: TObject; Guess: string);
    begin
     ... // Impossible to do something
    end;

     

    2° If I start a timer, the code in the timer works and the app does not lose control

    procedure TForm1.SpeechRecognition1Recognition(Sender: TObject; Guess: string);
    begin
     timer3.Enabled:=true;
    end;
    
    procedure TForm1.Timer3Timer(Sender: TObject);
    begin
     try
       ...
     finally
       timer3.Enabled:=false;
     end;
    end;

     

    3°  If I try to transmit the obtained answer through a global variable to be able to process it in the timer code, same behaviour of point 1 most of the time (it works sometimes...)

    procedure TForm1.SpeechRecognition1Recognition(Sender: TObject; Guess: string);
    begin
     G_Heard:=Guess;
     timer3.Enabled:=true;
    end;
    
    procedure TForm1.Timer3Timer(Sender: TObject);
    begin
     try
      ShowMessage('Start timer3: '+G_Heard);//DEBUG
     finally
      timer3.Enabled:=false;
     end;
    end;
    

     

    Does anyone have an explanation or solution to prevent the app from getting out of control?

     

    Thank you in advance


  16. 43 minutes ago, Vandrovnik said:

     

    You can still use:
     

    
     var MyFormat: TFormatSettings;
     MyFormat:=TFormatSettings.Create; // obtains default settings
    
     if pos('yyyy', MyFormat.ShortDateFormat)<=0
      then MyFormat.ShortDateFormat:=StringReplace(MyFormat.ShortDateFormat, 'yy', 'yyyy', []);
    
     ... DateToStr(now, MyFormat);

     

     

    Great! This is exactly what I was looking for!


    Your code uses the date format provided by the OS but forces the display of the year to 4 characters.


    Thanks a lot Vandrovnik!


  17. 4 hours ago, Lajos Juhász said:

    You failed to show us an example where are you have a problem. You can use FormatDateTime or DateToStr with yuor own format settings.

    1)

    If you use FormatDateTime to define in your Delphi code a custom date format as "yyyy-mm-dd", you will have this format regardless of the country where you use the software: 2022-08-05 in France, 2022-08-05 in USA, 2022-08-05 in Deutschland or in Japan.

     

    Each country has his standard. In France, the date format is "05/08/2022" and not "2022-08.05"! That's why the regional settings of an OS exist!

     

     

    2) Our software must be used worldwide. The date format must be adapted for the country where it is used.

     

    3. We don't want to replace the regional settings of the OS with Delphi code that specifies settings for every country in the world! We want that the regional settings display date with 4 characters ans not 2 for the year. That's it!

     

     


  18. 2 minutes ago, Lajos Juhász said:

    If you change the regional settings in your application you will change it in all of the countries the same thing as far as I can see.

    Here is my problem:

     

    Why the default TFormatSettings.ShortDateformat displays the year with 4 characters under Windows, but only with 2 characters under Android?

     

    Isn't there a way to notify Android that you want the year with 4 characters instead of 2 without changing the regional settings?


  19. 23 hours ago, Lajos Juhász said:

    Why would you like to change the regional settings for that case? Use a custom format to convert the date to string.

    When you have a software that is used in different countries, the date display format changes from one time to another (In France, you will have a "dd/mm/yyyy", in the USA a "mm-dd-yyyy", etc.). If you use a custom format in the code, you will have to create a custom format for each country!!!!!!!!!!

     

    So, I would simply force the display of the year with 4 characters instead of 2...


  20. I have a problem with FormatSettings.ShortDateFormat: When I use it to display a date according to the country standard (e.g. the order "day, month, year" is not suitable in the USA), the year is only displayed with 2 characters. I'd like to take advantage of the default date format defined by the Android device OS but force the year to be displayed with 4 characters instead of 2. If I force the date format (example with a "dd mm yyyy"), I will lose the automatic adaptation of the date format according to the country...

     

×