Jump to content

What is the problem is this code


molla2005b

Recommended Posts

i have a frame as Component (TFindAccountFrame)
this frame contain a combobox named cmbAccount
I 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

Link to comment
Share on other sites

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;
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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,

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...