CaptionClass property

BGIBGI Member Posts: 176
edited 2002-09-17 in Navision Attain
<img border="0" title="" alt="[Confused]" src="images/smiles/icon_confused.gif" /> Is there someone outthere that can explain me in brief how the captionclass property works, so i can use it to change the caption of a button during runtime ?
Rgds
Benny Giebens

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    I don't know if the CaptionClass works for menubuttons. Here is an example for renaming a caption of a field in a table.

    In Codeunit 1, you'll find a function CaptionClassTranslate. Change this as follows:

    </font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">CaptionClassTranslate(Language : Integer;CaptionExpr : Text[80]) : Text[80]
    CommaPosition := STRPOS(CaptionExpr,',');
    IF (CommaPosition > 0) THEN BEGIN
    CaptionArea := COPYSTR(CaptionExpr,1,CommaPosition - 1);
    CaptionRef := COPYSTR(CaptionExpr,CommaPosition + 1);
    CASE CaptionArea OF
    '1' : EXIT(DimCaptionClassTranslate(Language,CaptionRef));
    '2' : EXIT(VATCaptionClassTranslate(Language,CaptionRef));
    END;
    END;

    ltxtCaption := '';
    IF UPPERCASE(CaptionExpr) = 'TESTCAPTION'
    THEN ltxtCaption := 'New caption';
    EXIT(ltxtCaption);
    //EXIT('');</pre><hr /></blockquote><font size="2" face="Verdana, Arial">Now insert a new field 'Testfield' in a table, and fill in the CaptionClass-property with 'TESTCAPTION' (including the ').
    When you run the table, or place the field on a form and run that form, you'll see the name 'New caption' instead of the name 'Testfield'.

    In codeunit 1 you'll have to add code for multi-language.

    With Attain 3.01, I tried to rename a menu that way, but it wasn't possible. Maybe they have changed this with Attain 3.60?
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • BGIBGI Member Posts: 176
    Thnx for the info.
    Now at last i know how it works, but it isn't realy the thing i'm looking for.
    Thnx anyway
    Rgds
    Benny Giebens
  • RobiRobi Member Posts: 4
    Here are all secrets to Caption Class

    </font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[Procedure]CaptionClassTranslate (<LANGUAGE>;<CAPTIONEXPR>)
    LANGUAGE
    <DataType> := [Integer]
    <DataValue> := // Automatically mentioned by the system
    CAPTIONEXPR
    <DataType> := [String]
    <Length> <= 80
    <DataValue> := <CAPTIONAREA>,<CAPTIONREF>
    CAPTIONAREA
    <DataType> := [SubString]
    <Length> <= 10
    <DataValue> := 1..9999999999
    // 1 for Dimension Area
    // 2 for VAT
    CAPTIONREF
    <DataType> := [SubString]
    <Length> <= 10
    <DataValue> := IF (<CAPTIONAREA> = 1) <DIMCAPTIONTYPE>,<DIMCAPTIONREF>
    <DataValue> := IF (<CAPTIONAREA> = 2) <VATCAPTIONTYPE>
    DIMCAPTIONTYPE
    <DataType> := [SubString]
    <Length> <= 10
    <DataValue> := 1..6
    // 1 to retrieve Code Caption of Global Dimension
    // 2 to retrieve Code Caption of Shortcut Dimension
    // 3 to retrieve Filter Caption of Global Dimension
    // 4 to retrieve Filter Caption of Shortcut Dimension
    // 5 to retrieve Code Caption of any kind of Dimensions
    // 6 to retrieve Filter Caption of any kind of Dimensions
    DIMCAPTIONREF
    <DataType> := [SubString]
    <Length> <= 10
    <DataValue> := IF (<DIMCAPTIONTYPE> = 1) 1..2,<DIMOPTIONALPARAM1>,<DIMOPTIONALPARAM2>
    IF (<DIMCAPTIONTYPE> = 2) 1..8,<DIMOPTIONALPARAM1>,<DIMOPTIONALPARAM2>
    IF (<DIMCAPTIONTYPE> = 3) 1..2,<DIMOPTIONALPARAM1>,<DIMOPTIONALPARAM2>
    IF (<DIMCAPTIONTYPE> = 4) 1..8,<DIMOPTIONALPARAM1>,<DIMOPTIONALPARAM2>
    IF (<DIMCAPTIONTYPE> = 5) Dimension.[Field]Code,<DIMOPTIONALPARAM1>,<DIMOPTIONALPARAM2>
    IF (<DIMCAPTIONTYPE> = 6) Dimension.[Field]Code,<DIMOPTIONALPARAM1>,<DIMOPTIONALPARAM2>
    DIMOPTIONALPARAM1
    <DataType> := [SubString]
    <Length> <= 30
    <DataValue> := [String]
    // a string added before the dimension name
    DIMOPTIONALPARAM2
    <DataType> := [SubString]
    <Length> <= 30
    <DataValue> := [String]
    // a string added after the dimension name
    VATCAPTIONTYPE
    <DataType> := [SubString]
    <Length> = 1
    <DataValue> := '0' -> <field caption + 'Excl. VAT'>
    '1' -> <field caption + 'Incl. VAT'></pre><hr /></blockquote><font size="2" face="Verdana, Arial">
    ®obi
Sign In or Register to comment.