Jump to content

Recommended Posts

Posted

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.

 

Posted

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?

Posted

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.

Posted

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

Posted

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

Posted

Sorry. Don't work.

 

But I think it could be better in mainform script, because I do only once, not in every form and/or every dbgrid.

 

How can I do it?

 

Thanks.

Posted

as I can see, in general, add the code in run time to grids, don't work.

 

for this, I think is better to add in mainform script (as you told me with enableTextSelection).

Posted

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.

Posted

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;
Posted

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;
Posted

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.

Posted

Hi,

 

With CellContextClick, the event occurs only when the "right button" is clicked

With MouseDown, the event occurs when you press "any button"

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