I start a new mobile project. I drop a DPFUIScrollView on the form and set the alignment to alClient. Then I drop a DPFTextView on the scrollview and set the alignment to alClient. How do I handle making the textview resizing when the keyboard is present? I would like for it to resize when the screen is rotated as well. I realize I may not need a scrollview in this case since it is just one control.
Thanks!
Brent
Last edit: justapps 2013-09-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can find a sample in the ScrollViewTextField Demo. Otherwise, on your main form, create the VirtualKeyboardShown and VirtualKeyboardHidden events. In the VirtualKeyboardShown you will get the area above the keyboard in the Bounds const. Set your TextView's align to None and set its size to the Bounds. In the Hidden event, set it back to alClient.
I hope it helps.
Greetings
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for pointing me in the right direction. The demo has some missing arguments.
This seems to work:
privateFKBBounds:TRectF;...procedureTForm1.FormVirtualKeyboardHidden(Sender:TObject;KeyboardVisible:Boolean;constBounds:TRect);beginFKBBounds.Create(0,0,0,0);// seems to work ok without this lineTextView1.Align:=TAlignLayout.alClient;end;procedureTForm1.FormVirtualKeyboardShown(Sender:TObject;KeyboardVisible:Boolean;constBounds:TRect);beginTextView1.Align:=TAlignLayout.alNone;FKBBounds:=TRectF.Create(Bounds);TextView1.SetBounds(1,1,FKBBounds.Width,Height-FKBBounds.Height);end;
Last edit: justapps 2013-09-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I start a new mobile project. I drop a DPFUIScrollView on the form and set the alignment to alClient. Then I drop a DPFTextView on the scrollview and set the alignment to alClient. How do I handle making the textview resizing when the keyboard is present? I would like for it to resize when the screen is rotated as well. I realize I may not need a scrollview in this case since it is just one control.
Thanks!
Brent
Last edit: justapps 2013-09-09
Hi!
You can find a sample in the ScrollViewTextField Demo. Otherwise, on your main form, create the VirtualKeyboardShown and VirtualKeyboardHidden events. In the VirtualKeyboardShown you will get the area above the keyboard in the Bounds const. Set your TextView's align to None and set its size to the Bounds. In the Hidden event, set it back to alClient.
I hope it helps.
Greetings
Thanks for pointing me in the right direction. The demo has some missing arguments.
This seems to work:
Last edit: justapps 2013-09-10
I'm glad to help.
The Demo was made for a prior version of the ScrollView and hasn't been updated.
Just a hint: You can find how to post source code formatted in the Welcome topic. Please use it in the future. Thanks :)
Ok, thanks. I went back to test that. Now it's formatted correctly :)