Question

Lets say I have an intraweb application (written in Delphi 2010) with an iwEdit (called iweLookup) and an iwButton (iwbSearch). When enter is pressed in the iwEdit, I want the iwButton clicked.

The following code almost works, but I think I need something to re-render the page.

procedure TiwfLookupListing.iweLookupAsyncKeyDown(Sender: TObject;
  EventParams: TStringList);
begin
  if EventParams.Values['which'] = '13' then
  begin
    iwbSearchClick(Sender);
  end;
end;

However this requires a round trip to the server (which would be acceptable but not desirable). Ideally I'd like a way of doing it in Javascript - presumably in the ScriptEvents for the iwedit (but my Javascript skills are currently, um, limited)

Can anyone point me in the right direction?

Was it helpful?

Solution

I've pretty much solved this one, in the ScriptEvents for the button, for onKeyDown I used the following code:

if (event.which == 13) {
  IWBSEARCH_onclick(event);
  return false;
} else {
  return true;
}

But if there is a better way of doing it...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top