如何在Dynamics AX 4.0中显示工具提示?

时间:2023-01-28 22:31:00

I'm looking to add hover text to a given column in a grid with row specific data. I'm planning on overriding the mouse-enter event, but I'm unsure how to populate a Tooltip and have it display next to the mouse.

我希望将悬停文本添加到具有行特定数据的网格中的给定列。我打算覆盖鼠标输入事件,但我不确定如何填充工具提示并将其显示在鼠标旁边。

Any direction would be appreciated, thanks!

任何方向将不胜感激,谢谢!

**Edit: It looks like the method to override is actually called "Tooltip". I was able to override this and get a tooltip to display.

**编辑:看起来覆盖的方法实际上称为“工具提示”。我能够覆盖它并获得一个工具提示来显示。

The question remains: How to access the current row's data for the column that the Tooltip is on?

问题仍然存在:如何访问Tooltip所在列的当前行数据?

2 个解决方案

#1


1  

To show a tooltip with the description of the foreign key field, the following must be met:

要显示带有外键字段描述的工具提示,必须满足以下条件:

  1. Base your field on an extended data type
  2. 将您的字段基于扩展数据类型
  3. Put a relation on the extended data type
  4. 在扩展数据类型上建立关系
  5. Have the relation point to a base table
  6. 将关系指向基表
  7. Set the TitleField1 and TitleField2 attributes on the base table
  8. 在基表上设置TitleField1和TitleField2属性
  9. Have a unique index on the key fields of your base table
  10. 在基表的关键字段上有唯一索引

You can put the relation on the (transaction) table instead of the extended data type. Do that in AX 2012 or if the relation has more than one field to join.

您可以将关系放在(事务)表而不是扩展数据类型上。在AX 2012中执行此操作,或者如果关系具有多个要加入的字段。

#2


0  

Here's the tooltip code that I ended up using:

这是我最终使用的工具提示代码:

public str toolTip()
{
    ;
    return tblYourTable::find(this.value()).Description;
}

**Edit per Jan's comment to greatly simplify code

**根据Jan的评论编辑,以大大简化代码

#1


1  

To show a tooltip with the description of the foreign key field, the following must be met:

要显示带有外键字段描述的工具提示,必须满足以下条件:

  1. Base your field on an extended data type
  2. 将您的字段基于扩展数据类型
  3. Put a relation on the extended data type
  4. 在扩展数据类型上建立关系
  5. Have the relation point to a base table
  6. 将关系指向基表
  7. Set the TitleField1 and TitleField2 attributes on the base table
  8. 在基表上设置TitleField1和TitleField2属性
  9. Have a unique index on the key fields of your base table
  10. 在基表的关键字段上有唯一索引

You can put the relation on the (transaction) table instead of the extended data type. Do that in AX 2012 or if the relation has more than one field to join.

您可以将关系放在(事务)表而不是扩展数据类型上。在AX 2012中执行此操作,或者如果关系具有多个要加入的字段。

#2


0  

Here's the tooltip code that I ended up using:

这是我最终使用的工具提示代码:

public str toolTip()
{
    ;
    return tblYourTable::find(this.value()).Description;
}

**Edit per Jan's comment to greatly simplify code

**根据Jan的评论编辑,以大大简化代码