Posted March 29Mar 29 Hi, I'm testing a CollectionView to display a large number of data rows (literally 100,000) with images. The images will be loaded from the web. How can I achieve this using FGX? I apologize for asking, but there’s no documentation available. Thank you function TFormMain.cvGetItemCount(Sender: TObject): Integer; begin result := 10; end; procedure TFormMain.cvGetItemId(Sender: TObject; const AIndex: Integer; var AId: Int64); begin lHeader.Text := 'Header '+AIndex.ToString+','+AId.ToString; im.ImageName := 'https://picsum.photos/id/'+AId.ToString+'/200/300'; end;
March 29Mar 29 Hi. The ImageName property maps to a file on the local device. Accordingly, you need to download it additionally, for example using TfgAssetManager, and you can specify the name of the local file even if AssetManager has not downloaded it yet. As soon as the download is finished, the image will be displayed.
March 29Mar 29 Administrators Hello, 10 hours ago, barshad said: im.ImageName := 'https://picsum.photos/id/'+AId.ToString+'/200/300'; ImageName is just a reference on asset with name in TfgAssetsManager. It cannot be URL. There are at least 2 ways how to download image: Automatically via FGX Native. Look at the followed demo samples: Assets -> Images -> "Asynchronous image loading by URL". It demonstrates how to load image with Assets manager by URL via the Internet. TfgAssetsManager can download image. Manually. You can manually download all required images via the THttpClient component for example, than add images to TfgAssetsManager via Add method and Also keep in mind, the device has limited memory, so if you try to downoad 10K images to memory, application will crashed with OutOfMemory exception. However, AssetsManager has special mechanizm for it. Look at the demo "Assets" -> "Images" -> "Releasing image from memory" Quote procedure TFormMain.cvGetItemId(Sender: TObject; const AIndex: Integer; var AId: Int64); begin lHeader.Text := 'Header '+AIndex.ToString+','+AId.ToString; im.ImageName := 'https://picsum.photos/id/'+AId.ToString+'/200/300'; end; It's completly wrong code. You need to study the demo projects. Components -> TfgCollectionView. PS. All demo projects are available from the main menu File -> New -> FGX Sample If you have questions after trying our demo samples, feel free to ask here. Thank you
April 1Apr 1 Author Thank you Yaroslav, I have one more question please, where are OnGetFocused like event? I want to highlight, scale up and shadow to the focused item in CollectionView Thank you
April 1Apr 1 Administrators Hello, What do you mean about OnGetFocused? Item in collection view doesn't have focus in general. If you are talking about selection, so you should have a look at the: OnItemSelectionChanged, OnSelectionChanged Also if you would like to add custom selection behavior, look at the sample in Components -> TfgCollectionView -> Manual displaying selection
April 1Apr 1 Author I want to do this, this project is in Android Studio, I want to do this with FGX components Thank you Qemu 2025.04.01 - 15.27.16.06.mp4
April 8Apr 8 Administrators Unfortunately I have never tried to debug on Android TV. As far as I remember, the difference between a TV and a tablet or phone is that it is controlled by setting the focus. But I don't think that's how it will work for collection view by default. You may need to specify separately that the element can be focusable. But this can only be done directly through the Android API. But the benefit of FGX Native allows you to get direct access to the naive representation of each control.
April 8Apr 8 Author Forget that it's a TV app — it's not specifically a TV app. I just want to run it on Android TV or other non-Android TV boxes. It's a normal app. Even in Java (Android Studio), I use code to check whether an item is focused or has lost focus. Do you have any sample Android API code for that? Even a simple app with two Card Panels or Buttons would work. I only need to detect the focus event (not click) when the user uses the keyboard or arrow keys to move focus between components.
April 8Apr 8 Author Thank you, button are already focusable I want to know how to get the focus event.
April 8Apr 8 Author Also can you please publish the Interface sections of your library? that would be great help
April 8Apr 8 Administrators 3 minutes ago, barshad said: Thank you, button are already focusable I want to know how to get the focus event. Just assign TfgControl.OnEnter/TfgControl.OnExit event handlers programmatically.
April 8Apr 8 Administrators 2 minutes ago, barshad said: Also can you please publish the Interface sections of your library? that would be great help It's available in Release version.
April 8Apr 8 Author 8 minutes ago, Yaroslav Brovin said: It's available in Release version. When I try to open documentation https://docs.fgx-native.com/index.php/FGX.Controls.TfgControl it takes to some parked domain page
April 8Apr 8 Administrators Just now, barshad said: When I try to open documentation https://docs.fgx-native.com/index.php/FGX.Controls.TfgControl it takes to some parked domain page We had DDOS attack on our docwiki service like a Embarcadero. So we had to close this service until we will develop new replacement.
April 8Apr 8 Administrators HelpInsight is available. The biggest part of public API has xml docs. For Release version, developer can have a look at the xml docs in source code. It's localized in English.
Create an account or sign in to comment