Jump to content

Help to program an own component based on TUniEdit


bitschieber

Recommended Posts

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.

 

Link to comment
Share on other sites

  • Administrators

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)




			
		
Link to comment
Share on other sites

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

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