Reputation: 1080
I wrote a mobile app. I have a login panel and edits has a label which is a placeholder. (email/password)
edits onclick method change visible of labels. i also have onkeyboardshow to change the position of login panel. So when the user click the tedit, keyboard shown but label's visible does not change. if i click again the tedit, label's visible change.
So i added a some code to change label's visible when the keyboardshown.
procedure TformReg.FormVirtualKeyboardShown(Sender: TObject;
KeyboardVisible: Boolean; const Bounds: TRect);
begin
Rectangle1.Align:= TAlignLayout.Top;
Rectangle1.Margins.Left:= Trunc((screenW-362)/2);
Rectangle1.Margins.Right:= Trunc((screenW-362)/2);
if email.SetFocus = true then
lblEmail.Visible:= false
else
lblPassword.Visible:= false;
end;
But this code does not work, i have to understand which edit is focused. i am using delphi firemonkey xe6.
Error is incompitable types
Upvotes: 0
Views: 2298
Reputation: 106
Your code should be something like:
label1.Visible := edit1.Focused;
You can't test if something is "SetFocus" since SetFocus is a procedure that actually FOCUS some control, so you need to test if the control is FOCUSED.
Upvotes: 1