Jump to content

client events run time


jahlxx

Recommended Posts

H,

 

I do this for dbgrids in run time:

 

   tunidbgrid(xdbg).ClientEvents.unievents.Values['beforeinit']:='function beforeinit(sender, config)' +
             '{config.viewConfig.enableTextSelection = true;}';
 

This don't work.

 

How can I do it in run time?

 

Thanks.

 

Link to comment
Share on other sites

Hi,

 

H,

 

I do this for dbgrids in run time:

 

   tunidbgrid(xdbg).ClientEvents.unievents.Values['beforeinit']:='function beforeinit(sender, config)' +
             '{config.viewConfig.enableTextSelection = true;}';
 

This don't work.

 

Where do you use this code?

Link to comment
Share on other sites

Great!!

 

Thanks.

 

In mainfor is better.

 

And this?:

 

function containercontextmenu(sender, e, eOpts)
{
  ajaxRequest(this, 'cellcontextmenu', ['ex='+e.getXY()[0], 'ey='+e.getXY()[1]]);
}

 

ths is also for every grid (extevents).

 

Thanks.

Link to comment
Share on other sites

UniDBGrid -> OnCellContextClick event ??

but this don't work if grid is empty.

 

this is the reason of my prior post.

 

is possible to add in mainform script to not repeat in every dbgrid?

 

 

 

Enviado desde mi SM-A500FU mediante Tapatalk

Link to comment
Share on other sites

but this don't work if grid is empty.

 

Correct, because this applies to cells

 

 

is possible to add in mainform script to not repeat in every dbgrid?

 

Yes, it is possible, but I think, it is better to do this in the "code", for example, in the FormCreate event

Link to comment
Share on other sites

This is the code, in every dbgrid:

 

function containercontextmenu(sender, e, eOpts)
{
  ajaxRequest(this, 'cellcontextmenu', ['ex='+e.getXY()[0], 'ey='+e.getXY()[1]]);
}

 

 

And for not repeat in every one, I'm trying to do this:

 

   tunidbgrid(xdbg).ClientEvents.ExtEvents.Values['containercontextmenu']:='function containercontextmenu(sender, e, eOpts)' +
             '{ajaxRequest(this, cellcontextmenu, [ex=+e.getXY()[0], ey=+e.getXY()[1]]);}';
 

 

As you told me with cellcontextmenu, I'd like to do this in mainform script, and do only once, not in every dbgrid individually.

 

Thanks.

Link to comment
Share on other sites


procedure TMainForm.UniFormCreate(Sender: TObject);
begin
    UniDBGrid1.ClientEvents.ExtEvents.Values['containercontextmenu']:='function containercontextmenu(sender, e, eOpts)' +
    '{ajaxRequest(this, "_cellcontextmenu", ["ex="+e.getXY()[0], "ey="+e.getXY()[1]]);}';
end;
Link to comment
Share on other sites

Sorry, but don't work.

 

It does nothing if dbgrid is empty.

 

 

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
    UniDBGrid1.ClientEvents.ExtEvents.Values['containercontextmenu']:='function containercontextmenu(sender, e, eOpts)' +
    '{ajaxRequest(this, "_cellcontextmenu", ["ex="+e.getXY()[0], "ey="+e.getXY()[1]]);}';
end;
procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = '_cellcontextmenu' then
  begin
    ShowMessage('click');
  end;

end;
Link to comment
Share on other sites

ok. works.

 

but could be better this?:

 

procedure TMainForm.UniDBGrid1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
   if button=mbRight then
      menu.Popup(X, Y, UniDBGrid1);
end;
 

Using MouseDown instead of CellContextClick.

 

Only with this don't need any more. It works without ajaxrequest.

 

Is only a question.

 

Could be this better solution? More clear?

 

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