Jump to content

ExtEvents Some Action + params meaning


mazluta

Recommended Posts

1. on my form i have 2 TUniEdit1

i want to add ExtEvent to TUniEdit1 onkeyup

if the user click "^" in the TUniEdit1 i want to set TUniEdit1.Text to 'Hello' inside the OnKeyUp Clieck Event of the ExtEvent

 

2. in the ExtEvent, Whet is Sender? How Can I See What Is Members and Property Are?

what is e - the same for Members and Property Are?

what is eOpts - the same for Members and Property Are?

 

3. what is "document" or "windows" or "body" as relational to My FORM/FRAME

 

4. can i run ExtEvent OnKeyUp and the TUniEdit1.OnKeyUp on the same FORM/FRAME?

what come first? is the ExtEvent is allwes ClientSide And Object.DelphiEvent is Server Side?

 

5. where can i find deeper documents on the ExtEvent for Older Delphi Developers

Link to comment
Share on other sites

Hi,

If you take a look at the UniEdit1 > ClientEvents > ExtEvents you will see what ExtJS object it is using. Which is Ext.form.Field.Text. And then you can look at the documentation for Ext.form.Field.Text in ExtJS.

1 hour ago, mazluta said:

if the user click "^" in the TUniEdit1 i want to set TUniEdit1.Text to 'Hello' inside the OnKeyUp Clieck Event of the ExtEvent

1. UniEdit1 > ClientEvents > ExtEvents > keyup:

function keyup(sender, e, eOpts)
{
   if (e.shiftKey && e.keyCode === 54) {
      sender.setValue('hello');
   }
}

 

1 hour ago, mazluta said:

in the ExtEvent, Whet is Sender? How Can I See What Is Members and Property Are?

2. from: https://docs.sencha.com/extjs/7.0.0/classic/Ext.form.field.Text.html#event-keyup
image.png.3f45e0bcbfbb6b046e7afa0e655b926a.png

Sender = Ext.form.field.Text (or UniEdit1 in serverside)
e = Javascript event object
eOpts = (not sure)

 

1 hour ago, mazluta said:

what is e - the same for Members and Property Are?

you can try to console.log(e) on keyup event to see what are the properties.

 

1 hour ago, mazluta said:

where can i find deeper documents on the ExtEvent for Older Delphi Developers

you can take a look at ExtJS documentation to see more ExtEvents and its documentation.


Hope it helps.


Regards

Link to comment
Share on other sites

WOW. thanks very much. a lot of reading.

one more Q.

 

i write keyup extevent like this : the purpose is to get the position of the cursor inside the text.....

function keyup(sender, e, eOpts)
{
  document.getElementById("M1234_aa-inputEl").value = e.target.selectionStart.toString();
  /*document.getElementById("MyResultString").value = e.target.selectionStart.toString();*/
  
  fLbl = document.getElementById("MyResultString");
  fLbl.setText(e.target.selectionStart.toString());
}

M1234_aa-inputEl -> is TUniedit and that work.

MyResultString -> is some TUniLable - i want is caption to change to the same value - The SetText doesn't do nothing.

Link to comment
Share on other sites

i tried 

function keyup(sender, e, eOpts)
{
  document.getElementById("M1234_aa-inputEl").value = e.target.selectionStart.toString();
  /*document.getElementById("MyResultString").value = e.target.selectionStart.toString();*/
  
  console.log("sender=" + sender);
  console.log("e=" + e);
  console.log("eOpts=" + eOpts);

  
  fLbl = document.getElementById("MyResultString");
  fLbl.setText(e.target.selectionStart.toString());
}

the result :

 

sender=[object Object] - this give me nothing
VM247:1 e=[object Object]
VM247:1 eOpts=undefined

 

how do i print to the console the TYPE of the obj

like :

sender= Ext.form.Field.Text

Link to comment
Share on other sites

i tryed.

procedure TIturDocumentFrame.btnSendMailClick(Sender: TObject);
Var
  FileAttche : String;
begin
  If Not fIturResultFrame.DocumentsQry.Active Then
    Exit;
  If fIturResultFrame.DocumentsQry.RecordCount = 0 Then
    Exit;
  FileAttche := fIturResultFrame.DocumentsQry.FieldByName('Mz_FileName').AsString;

  NewSendMailFrm := TSendMailFrm.Create(UniApplication);
  NewSendMailFrm.FilesAttchLists.Add(FileAttche);
  NewSendMailFrm.ShowModal(CallBack_SendMail);
end;
 

the ExtEvent dont reconize this name and not - SendMailFrm

Link to comment
Share on other sites

5 minutes ago, mazluta said:

NewSendMailFrm := TSendMailFrm.Create(UniApplication);
  NewSendMailFrm.FilesAttchLists.Add(FileAttche);
  NewSendMailFrm.ShowModal(CallBack_SendMail);

oh okay so it is dynamically created? u should put a name to your form like: NewSendMailFrm.Name := 'SendMailFrm';

for it to be recognize in javascript console

Link to comment
Share on other sites

image.png.ac1293c83e8d0a562391efae9af654af.png

see the cursor is between the char 7 and the char d -> position 7 in the TUniEdit

function keyup(sender, e, eOpts)
{
  document.getElementById("M1234_aa-inputEl").value = e.target.selectionStart.toString();         the UniEdit just by Id name (given in the form create -                       

           edCCList.JSControl.Id := 'M1234_aa';
         watch that the INPUT name is - M1234_aa-inputEl

  MySendMailFrm.ExtEventResultString.setText(e.target.selectionStart.toString());       the UniLabel by form name and component name
}

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...