playsoft Posted March 31, 2018 Share Posted March 31, 2018 Hello, I would like to know how to use the ENTER KEY to change the focus of the edit instead of TAB in a frame, since onkeydown and monitoredkeys do not exist in the frame. Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted March 31, 2018 Share Posted March 31, 2018 Use NavigateKeys property of the form that contains the frame. Quote Link to comment Share on other sites More sharing options...
playsoft Posted March 31, 2018 Author Share Posted March 31, 2018 Thanks, it worked perfectly. Quote Link to comment Share on other sites More sharing options...
playsoft Posted March 31, 2018 Author Share Posted March 31, 2018 Hello again, I now need to press the f2 key for the click of the btnTest button since the frame does not have the onkeydown event. If someone can put it to work, please share the solution. Attached example Att, Playsoft +55 (69) 99250-3445 FrameKeyDown.zip 1 Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted March 31, 2018 Share Posted March 31, 2018 I have made an interface with a FnKeyDown procedure and every frame implements that interface. In Mainform I call in onKeyDown the interface procedure of the active Frame. Quote Link to comment Share on other sites More sharing options...
playsoft Posted March 31, 2018 Author Share Posted March 31, 2018 Brother can you share an example of this by courtesy? Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted March 31, 2018 Share Posted March 31, 2018 I will share when at PC again. Quote Link to comment Share on other sites More sharing options...
playsoft Posted March 31, 2018 Author Share Posted March 31, 2018 Brother, thank you very much, I'll be waiting for you then. If you can call me on Whastapp or Telegram or skype +55 (69) 99250-3445 Skype: junior.jaru Thanks again, I'll be waiting. Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted March 31, 2018 Share Posted March 31, 2018 1. Interface: unit UKeyDown; interface uses System.Classes; type IKeyDown = Interface ['{C21C434B-E6F7-4E2C-98CB-3ACC526566BE}'] procedure FnKeyDown(Sender: TObject; Key: Word; Shift: TShiftState); End; implementation end. 2. In each Frame: Uses ... UKeyDown; type TfraTest = class(TUniFrame, IKeyDown) ... public procedure FnKeyDown(Sender: TObject; Key: Word; Shift: TShiftState); end; procedure TfraTest.FnKeyDown(Sender: TObject; Key: Word; Shift: TShiftState); begin case Key of VK_F1: begin ShowMessage(scKeys.Strings.Text); end; ... end; end; In MainForm: var ts: TUniTabSheet; i: Integer; fr: TUniFrame; kd: IKeyDown; begin case Key of VK_F1..VK_F10: begin ts := PageCtrl.ActivePage; if ts = nil then begin EXIT; end; fr := nil; for i := 0 to ts.ControlCount - 2 do begin if ((ts.Controls[i] is TUniFrame) and (ts.Controls[i+1] is TUniSimplePanel) and (ts.Controls[i+1].Visible)) then begin fr := TUniFrame(ts.Controls[i]); BREAK; end; end; if fr <> nil then begin if Supports(fr, IKeyDown, kd) then kd.FnKeyDown(Sender, Key, Shift); end; end; end; end; => I have a Pagecontrol with tabsheets and on each tabsheet there are one or more frames, but only one frame is visible. And this active frame I search for and call FnKeyDown. Quote Link to comment Share on other sites More sharing options...
playsoft Posted March 31, 2018 Author Share Posted March 31, 2018 It did not work, please give a light .... rsrsrs, it follows attached what I did. FrameKeyDown.zip Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted March 31, 2018 Share Posted March 31, 2018 Here: FrameKeyDown.zip Quote Link to comment Share on other sites More sharing options...
playsoft Posted March 31, 2018 Author Share Posted March 31, 2018 Brother thank you very much, it worked perfectly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.