molla2005b Posted September 19, 2017 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
molla2005b Posted September 19, 2017 Author 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
Administrators Farshad Mohajeri Posted September 19, 2017 Administrators Posted September 19, 2017 Is it the name of frame instance: FindAccountFrame Quote
erich.wanker Posted September 20, 2017 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
molla2005b Posted September 20, 2017 Author 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
Sherzod Posted September 20, 2017 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
molla2005b Posted September 20, 2017 Author Posted September 20, 2017 sorry . not work I send u a test case spkey.rar Quote
Sherzod Posted September 20, 2017 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
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.