TTMSFMXNativeUICollectionView Item/Keyboard

I want to do inplace editing using a UITextField. How can I ensure that the item isn't covered by the keyboard. I have tried using ScrollToItem in the OnItemTextFieldDidBeginEditing but this doesn't seem to do anything.



You need to manually position you control in the OnVirtualKeyBoardShown / OnVirtualKeyBoardHidden events on form level.

Kind Regards, 

I have also tried this but can't manage to get the collection view item to scrool into position. Do you have an example?


We have investigated the OnItemTextFieldDidBeginEditing approach and this works as expected here with the code below, after adding a TextField item template control to the CityTrip demo. Clicking the Textfield scrolls the item to the top of the CollectionView. Are you sure you have added the correct event: OnItemTextFieldDidBeginEditing ?

procedure TForm1.CityTripItemTextFieldDidBeginEditing(Sender: TObject;
  AControl: TTMSFMXNativeUICollectionViewTemplateControl; ASection,
  ARow: Integer);
  CityTrip.ScrollToItem(ASection, ARow, spCollectionViewScrollPositionTop, True);

Kind Regards, 

I still can't get this to work. What am I missing?


Please send us your code so we can investigate this here.

Thanks but I can now see the reason. If I have more rows than will fit on a screen it works fine but if not then it can't scroll. Can you think of any other way I can handle this with fewer rows?

Additionally, isaid that it works, but it only works the first time.

If you have less rows than what is displayed on the screen, then how do you expect to scroll to a row that is already visible? Please also explain what is not clear when saying that it only works the first time?


If I have lots of items and use ScrollToItem in the OnItemTextFieldDidBeginEditing event it scrolls nicely when I start to edit a row near the bottom. However if after that a do it again for another item near the bottom it doesn't scroll at all.

The best solotion I have found so far is to set the forms Padding.Bottom:=Bounds.Height; in the forms OnVirtualKeyboardShown event and reset it in the OnVirtualKeyboardHidden event and not use ScrollToItem at all.