Key Processing focus

Source: Internet
Author: User
procedure TFrameEntry.aplctnvnts1Message(var Msg: tagMSG; var Handled: Boolean);var  aWinControl: TWinControl;begin  if (Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP) then begin    if Assigned(FCurrentEditBox) and (Msg.wParam = VK_F1) and      (Screen.ActiveControl <> FCurrentEditBox) then    begin      if FCurrentEditBox.CanFocus then        FCurrentEditBox.SetFocus;      Handled := True;      Exit;    end;  end;  if not (Screen.ActiveControl is TEdit) then Exit;  if (Msg.message = WM_RBUTTONDOWN) or (Msg.message = WM_PASTE) then begin    Handled := True;  end else  if (Msg.message = WM_SYSKEYDOWN) or (Msg.message = WM_SYSKEYUP)then begin    if Msg.wParam in [VK_TAB, VK_RWIN, VK_APPS, VK_SLEEP, VK_F10] then      Handled := True;  end else  if (Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP) then begin    if (ssCtrl in KeyDataToShiftState(Msg.lParam)) then begin      if (Msg.wParam in [Ord(‘C‘), Ord(‘V‘)]) or        (Msg.wParam in [VK_TAB, VK_RWIN, VK_APPS, VK_SLEEP]) then      begin        Handled := True;      end else    end else      if Msg.message = WM_KEYDOWN then begin      if Msg.wParam = VK_RETURN then begin        aWinControl := FindNextControl(Screen.ActiveControl, true, false, false);        if (aWinControl is TEdit) and aWinControl.CanFocus then begin          aWinControl.SetFocus;          if FIsFirstEditBox then FIsFirstEditBox := False;        end else begin          FIsLastEditBox := True;          lbl3.Caption := ‘Last‘;        end;        Handled := True;      end else      if Msg.wParam = VK_F9 then begin        aWinControl := FindNextControl(Screen.ActiveControl, False, false, false);        if (aWinControl is TEdit) and aWinControl.CanFocus then begin          aWinControl.SetFocus;          if FIsLastEditBox then FIsLastEditBox := False;        end else begin          FIsFirstEditBox := True;          lbl3.Caption := ‘First‘;        end;        Handled := True;      end;    end;  end;end;


Key Processing focus

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.