al-code-outline icon indicating copy to clipboard operation
al-code-outline copied to clipboard

Add Tooltip: Consider Tablefield Caption

Open DavidFeldhoff opened this issue 4 years ago • 7 comments

Hi Andrzej, thanks for the Add Tooltip command. We used it last time and it worked pretty good, but there's one thing which would be good to be improved. The issue is with table extensions and with "MemberAccessExpressions" like NewTable.NewField. In these cases the Tablefield Caption isn't considered (see my two comments in the "after"-example at the last two page fields) But in other cases it works like a charm (see the page 50100). I reproduced it with this simple project. Do you think that's possible to add? Before command:

table 50100 NewTable
{
    fields
    {
        field(50100; DFENewField; Text[250]) { Caption = 'Tablefield Caption'; }
    }
}
tableextension 50100 "DFECustomerExt" extends Customer
{
    fields
    {
        field(50100; DFENewField; Text[250]) { Caption = 'Tablefield Caption'; }
    }
}
page 50100 NewPage
{
    SourceTable = NewTable;

    layout
    {
        area(Content)
        {
            field(DFENewField; Rec.DFENewField)
            {
            }
        }
    }
}

pageextension 50100 DFECustomerListExt extends "Customer List"
{
    layout
    {
        addlast(content)
        {
            field(DFENewFieldWithCaption; Rec.DFENewField)
            {
                Caption = 'Pagefield Caption';
            }
            field(DFENewFieldWithoutCaption; Rec.DFENewField)
            {
            }
            field(NewTable; NewTable.DFENewField)
            {
            }
        }
    }
    var
        NewTable: Record NewTable;
}

After command "Add Tooltip"

table 50100 NewTable
{
    fields
    {
        field(50100; DFENewField; Text[250]) { Caption = 'Tablefield Caption'; }
    }
}
tableextension 50100 "DFECustomerExt" extends Customer
{
    fields
    {
        field(50100; DFENewField; Text[250]) { Caption = 'Tablefield Caption'; }
    }
}
page 50100 NewPage
{
    SourceTable = NewTable;

    layout
    {
        area(Content)
        {
            field(DFENewField; Rec.DFENewField)
            {
                ToolTip = 'Specifies the value of the Tablefield Caption field';
            }
        }
    }
}
pageextension 50100 DFECustomerListExt extends "Customer List"
{
    layout
    {
        addlast(content)
        {
            field(DFENewFieldWithCaption; Rec.DFENewField)
            {
                Caption = 'Pagefield Caption';
                ToolTip = 'Specifies the value of the Pagefield Caption field';
            }
            field(DFENewFieldWithoutCaption; Rec.DFENewField)
            {
                ToolTip = 'Specifies the value of the DFENewField field';  //Not expected: Would like to have the Tablefield Caption
            }
            field(NewTable; NewTable.DFENewField)
            {
                ToolTip = 'Specifies the value of the NewTable.DFENewField field';  //Not expected: Would like to have the Tablefield Caption
            }
        }
    }
    var
        NewTable: Record NewTable;
}

DavidFeldhoff avatar Apr 22 '21 11:04 DavidFeldhoff

It is a bug, I have to fix it.

anzwdev avatar Apr 22 '21 22:04 anzwdev

Nice, thanks :)

DavidFeldhoff avatar Apr 24 '21 07:04 DavidFeldhoff

I've fixed it and released a new version of the extension.

anzwdev avatar May 02 '21 18:05 anzwdev

Hi Andrzej, thanks for your effort so far. Unfortunately, it is not working entirely. But I guess it's another issue, I found. The caption of a field, declared in a table extension, is not taken into account, if inside the table extension is a field modification as well. See the example:

table 50100 NewTable
{
    fields
    {
        field(50100; DFENewField; Text[250]) { Caption = 'Tablefield Caption'; }
    }
}
tableextension 50100 "DFECustomerExt" extends Customer
{
    fields
    {
        modify("No.") { Description = 'Test'; } //because there's a field-modification the caption is not taken anymore into account
        field(50100; DFENewField; Text[250]) { Caption = 'Tablefield Caption'; }
    }
}
page 50100 NewPage
{
    SourceTable = NewTable;

    layout
    {
        area(Content)
        {
            field(DFENewField; Rec.DFENewField)
            {
            }
        }
    }
}

pageextension 50100 DFECustomerListExt extends "Customer List"
{
    layout
    {
        addlast(content)
        {
            field(DFENewFieldWithCaption; Rec.DFENewField)
            {
                Caption = 'Pagefield Caption';
            }
            field(DFENewFieldWithoutCaption; Rec.DFENewField)
            {
            }
            field(NewTable; NewTable.DFENewField)
            {
            }
        }
    }
    var
        NewTable: Record NewTable;
}

The result is the same as in my previous post (Tooltip uses DFENewField as Caption). As far as I throw away the field modification, reload the window (I guess you're caching something?) and rerun the command, everythings fine.

DavidFeldhoff avatar May 11 '21 14:05 DavidFeldhoff

Hi David

Thank you for reporting this problem. I've released a new version of the extension and fixed these 2 issues:

  • extension was crashing if there was a field modification in the table extension.
  • changes to the field captions in the field modification were ignored Unfortunately symbol references file inside the app file does not contain information about field changes, so if a field caption is changed by one of the dependencies of your project, tooltip/caption commands won't see it.

anzwdev avatar May 15 '21 17:05 anzwdev

Thanks, Andrzej :) I'll test it out the next days!

DavidFeldhoff avatar May 16 '21 17:05 DavidFeldhoff

Hi Andrzej, I can't tell you why, but in some cases it's not working. I have a case where in a page extension a field of a table extension (of the same project) is added, but the caption is not taken of the table extension. But in some other cases it works... Should wo look at it together and debug through it? I can't tell you exactly what's the difference there..

DavidFeldhoff avatar May 20 '21 06:05 DavidFeldhoff