molla2005b Posted September 19, 2017 Share Posted September 19, 2017 function specialkey(sender, e, eOpts) { if (! (e.shiftKey) && (e.getKey () == 13)) { e.stopEvent (); frmOrder.FindAccountFrame.cmbAccount.focus(); } } I want to set focus of cmbAccount control cmbAccount is owned by FindAccountFrame frame. thanks for help Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 19, 2017 Share Posted September 19, 2017 Hi, What problem do you have? Quote Link to comment Share on other sites More sharing options...
molla2005b Posted September 19, 2017 Author Share Posted September 19, 2017 i have a frame as Component (TFindAccountFrame)this frame contain a combobox named cmbAccountI want to move the focus from a control to cmbAccount by Enter key but this code note work : frmOrder.FindAccountFrame.cmbAccount.focus(); How I can get the right name of cmbAccount in specialkey evevt. thanks Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted September 19, 2017 Administrators Share Posted September 19, 2017 Is it the name of frame instance: FindAccountFrame Quote Link to comment Share on other sites More sharing options...
molla2005b Posted September 20, 2017 Author Share Posted September 20, 2017 yes Quote Link to comment Share on other sites More sharing options...
erich.wanker Posted September 20, 2017 Share Posted September 20, 2017 i made similar thing .. for me works: (MainForm.FCurrentFrame1 as Tmy_frame_name).uniedit .. set focus FCurrentFrame1 is TUniFrame i load frames with: procedure TMainForm.InsertFrame1(Name: string); begin if FFrameName1 <> '' then FreeAndNil(FCurrentFrame1); FFrameName1:=Name; FCurrentFrame1:=TUniFrameClass(FindClass(Name)).Create(self); FCurrentFrame1.Align:=alClient; FCurrentFrame1.Parent:=display;//uniscrollbox1; Quote Link to comment Share on other sites More sharing options...
molla2005b Posted September 20, 2017 Author Share Posted September 20, 2017 Thanks all my problem in javascript code finally I slove it by this code s:='function specialkey(sender, e, eOpts) '+ ' { '+ ' if (!(e.shiftKey) && (e.getKey() == 13))'+ ' { '+ ' e.stopEvent(); '+ ' '+FindAccountFrame.cmbAccount.JSName+'.focus();'+ ' }'+ ' }'; cmbType.ClientEvents.ExtEvents.Values['specialkey']:=s; but why frmOrder.FindAccountFrame.cmbAccount.focus(); not work? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 20, 2017 Share Posted September 20, 2017 Hi, But why frmOrder.FindAccountFrame.cmbAccount.focus(); not work? ExtJS's focus( [selectText], [delay] ) method accepts defer (delay) as an argument, so you can try to use it: frmOrder.FindAccountFrame.cmbAccount.focus(false, 250); Best regards, Quote Link to comment Share on other sites More sharing options...
molla2005b Posted September 20, 2017 Author Share Posted September 20, 2017 sorry . not work I send u a test case spkey.rar Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 20, 2017 Share Posted September 20, 2017 Hi, frmOrder.FindAccountFrame.cmbAccount.focus(false, 250); Sorry, I did not notice it, yes it will not work FindAccountFrame.cmbAccount - it is Correct 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.