Jump to content

Recommended Posts

Posted
Hello,
I need help to program an own component based on TUniEdit (JSObjects.DefaultJSClassName: = 'Ext.form.field.Text' ;).
My questions:
 
1. How you can access the keypressed event on the Objectmetode e.stopEvent?
In the Procedure "LoadCompleted" I initialize the event as follows;
JSAddEvent ('keypress', ['eventObj', '%1.nm', 'Key', '%1.charCode'], onkeypress);
In Delphi onkeypress Ereigniss I would like to:
 
Params.Values ​​['eventObj'] access e.stopEvent, how?
 
This works:
c: = char (StrToIntDef (string (Params.Values ​​['key']), 0));
 
2. How can I set the maskRe config right?
This does not work:
JSConfig ('maskRe' ['/ [0-9] /']), or
JSConfig ('maskRe', ['new RegExp (/ [0-9] /)']);
 
 
3. How to pass 2 parameters with JSProperty:
 
JSProperty ('', [2], 'select text') / / this works and sets the start parameter
how can you pass the end parameter?
(select text ([start], [end]));
 

 

 
Thanks for your help.

 

  • Administrators
Posted

e.stopEvent() is a JS function. It can only be accessed on client side.

JSConfig('maskRe', [JSStatement('new RegExp("/[0-9]/")')]);
JSConfig('maskRe', [JSStatement('/[0-9]/')]);
JSCall( 'selectText', [1, 10] );
  • Administrators
Posted

You can try this:

JSAddEvent('keypress', ['obj', '%0.nm', 'Key', '%1.charCode'], 'P1.stopEvent()', onkeypress);

%0, %1, %2,... are event parameters in function declaration.

P0, P1, P2,... are event parameters in auxiliary JS statement.

(Which means %0 and P0 are referring to same parameter)




			
		
Posted

Hi Farshad,

 

I do not understand the treatment:
"P0, P1, P2, ... are event parameters in JS auxiliary statement."
 
My example:
JSAddEvent ('keypress', ['Key', '%1.charCode'], 'P1.stopEvent()', onkeypress);


procedure TUniZeit24.OnKeyPress(This: TJSObject; EventName: string; Params: TUniStrings);
var c:char;
begin
  c := char(strtointdef(string(Params.Values['Key']),0));
  if not (c in ['0','1','2','3','4','5','6','7','8','9','-','+',' ']) then begin
    

    // Here i will stop the Keypress Event via stopEvent
    
  end;
  // do something with c
end;

Thanks

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...