Jump to content

How to use variable declared on uniMainModule in uniEdit.keydown


irigsoft

Recommended Posts

Hello.

I need to read (and use) value in MyVariable declared as public on uniMainModule 

I have uniEdit.ClientEvents.ExtEvents  keydown and I want to show alert with MyVariable value, is it possible to do it?

function keydown is hardcoded on uniEdit, so is not possible to use it when form is created.

Link to comment
Share on other sites

4 hours ago, irigsoft said:

I have uniEdit.ClientEvents.ExtEvents  keydown and I want to show alert with MyVariable value, is it possible to do it?

function keydown is hardcoded on uniEdit, so is not possible to use it when form is created.

Hello, 

Can you please explain in more detail? 

Link to comment
Share on other sites

5 hours ago, Sherzod said:

Hello, 

Can you please explain in more detail? 

Hi.

uniMainMOdule

public

ReplacePswCnt : Integer;
 

 

1. FormCreate

ReplacePswCnt := 5;
 

2. uniEdit.ClientEvents.ExtEvents.Values ['keydown']

image.thumb.png.384809efc9b200d5e7fafdecd35c5a54.png

 

3. I enter some key and result must be (ReplacePswCnt + 5) = 10:

alert ('key=10');

 

4. result

nothing is happening  !

 

 

Link to comment
Share on other sites

10 hours ago, irigsoft said:

is possible to give me some kind of code example ?

Sorry for late response.

One possible solution:

1. UniEdit1...

function keydown(sender, e, eOpts)
{
    var customVar = ajaxRequest(sender, 'getCVar', {}, false).responseText;
    alert(parseInt(customVar) + 5);
}

2. 

procedure TMainForm.UniEdit1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'getCVar' then
  begin
    // Instead of 10, "any variable"...
    UniSession.SendResponse(10.ToString());
  end;

end;

 

  • Thanks 1
Link to comment
Share on other sites

1 minute ago, Sherzod said:

Sorry for late response.

One possible solution:

1. UniEdit1...

function keydown(sender, e, eOpts)
{
    var customVar = ajaxRequest(sender, 'getCVar', {}, false).responseText;
    alert(parseInt(customVar) + 5);
}

2. 

procedure TMainForm.UniEdit1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'getCVar' then
  begin
    // Instead of 10, "any variable"...
    UniSession.SendResponse(10.ToString());
  end;

end;

 

Thanks I will try it.

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