Jump to content

UniDbGrid cell hints


dpfmp

Recommended Posts

Hi,

In many grids, I use cell hints to display different information than the one that appears inside the cell.

For example, one cell contains information about a license number, the hint would display the client name that is associated with this license number.

I have a function in MainForm that returns the client firstName and lastName for that particular license:

function  TMainForm.GetClientName(const Licence: integer): string;
var
  S: string;
begin
  with ClientTB do
  begin
    if FindKey([Licence]) then
      Result := S + Trim(Fields[2].AsString) + ' ' + Trim(Fields[1].AsString);
    else
      Result := '';
  end;
end;

 

What I am trying to achieve is this:

image.png.64a8f63f826febf864edfb953a583616.png

 

I am using this code from here:

UniDbGrid.ClientEvents.ExtEvents

image.png.24c64ee21926e3d2db5aa5f705cde7bc.png

Finally my question is:

How can I access MainForm.GetClientName with record.data[3] as parameter so that I can display the information about the client in the tooltip?

Thank you,

Denis Prince

D10.1 UniGUI 1.70.0.1493

 

 

  • Like 1
Link to comment
Share on other sites

On 4/18/2019 at 5:37 PM, dpfmp said:

How can I access MainForm.GetClientName with record.data[3] as parameter so that I can display the information about the client in the tooltip?

Hi Denis, 

You can also select those fields in the main query, and not display these fields in the grid, and you can refer to them by the record.data[indx] 

Link to comment
Share on other sites

Hi Sherzod,

I am converting this Delphi Win32 project which is using DevExpress grids and NexusDB database engine.

One form can show information on up to 15 tables (grids) in a M/D relationship. The OnSelectionChange is used with a SetRange ( direct access cursors ) in most places for very fast performance and the same grid on the form can be used to display information from different tables ( views created dynamically ).

Selecting the fields in the main query would mean converting everything to SQL or adding calcuted fields to almost every cursor in order to have access to the lookup information which would mean a lot of changes in the original code which is using the 'onGetCellHint' from the DevEx grid to access the information using a call to an external function.

Can the client ExtEvent 'viewready' have access to data that is not already loaded in the grid?   or is it just not supposed to and I am using it the wrong way?

Than you again for your help,

Denis Prince

  • Upvote 1
Link to comment
Share on other sites

6 minutes ago, dpfmp said:

Can the client ExtEvent 'viewready' have access to data that is not already loaded in the grid?   or is it just not supposed to and I am using it the wrong way?

Hi Denis, 

I will try to analyze 

  • Upvote 1
Link to comment
Share on other sites

6 hours ago, dpfmp said:

Selecting the fields in the main query would mean converting everything to SQL or adding calcuted fields to almost every cursor in order to have access to the lookup information which would mean a lot of changes in the original code which is using the 'onGetCellHint' from the DevEx grid to access the information using a call to an external function.

Can the client ExtEvent 'viewready' have access to data that is not already loaded in the grid?   or is it just not supposed to and I am using it the wrong way?

In this case, I think the best option would be if you will use an action column - "Show more info..."
 

Link to comment
Share on other sites

This would mean adding sometimes 3 or 4 action columns to the grid just to display the lookup information. This is not exactly the way the cell hint works in Devex but I am wondering if it is possible to use the tooltip to get the same behaviour...

All my grids are in read-only mode. I guess I could use the OnCellClick to display the lookup information. Not as clean as passing the information in the tooltip but if it's not possible...

Thank you

 

 

  • Upvote 1
Link to comment
Share on other sites

On 4/18/2019 at 9:37 AM, dpfmp said:

Hi,

In many grids, I use cell hints to display different information than the one that appears inside the cell.

For example, one cell contains information about a license number, the hint would display the client name that is associated with this license number.

I have a function in MainForm that returns the client firstName and lastName for that particular license:

function  TMainForm.GetClientName(const Licence: integer): string;
var
  S: string;
begin
  with ClientTB do
  begin
    if FindKey([Licence]) then
      Result := S + Trim(Fields[2].AsString) + ' ' + Trim(Fields[1].AsString);
    else
      Result := '';
  end;
end;

 

What I am trying to achieve is this:

image.png.64a8f63f826febf864edfb953a583616.png

 

I am using this code from here:

UniDbGrid.ClientEvents.ExtEvents

image.png.24c64ee21926e3d2db5aa5f705cde7bc.png

Finally my question is:

How can I access MainForm.GetClientName with record.data[3] as parameter so that I can display the information about the client in the tooltip?

Thank you,

Denis Prince

D10.1 UniGUI 1.70.0.1493

 

 

 

I was interested in this event ...

to simply show the content of the field ...

How do I make an event call when positioning the mouse without a grid?

Thank you !!!

 

Att.:

Gustavo Déo

Link to comment
Share on other sites

  • 2 weeks later...

Hi Sherzod,

I know you are very busy but have you had a chance to check it again and see if it is possible to use the toolTip to show information from the lookup table?

Thank you again for your help,

Denis Prince

  • Like 1
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...