Highlight row in grid

mikkelbmmikkelbm Member Posts: 4
Hi,

I'm pretty new to C/AL development, and I'm looking for a way to highlight/bold the text of a row in a grid.

I found a way by doing something like this:

No. - OnFormat(VAR Text : Text[1024];) // The format-method

IF ("Marked for Routing" = USERID) THEN BEGIN
  CurrForm."No.".UPDATEFONTBOLD(TRUE);
  CurrForm."No.".UPDATEFORECOLOR(255);
END ELSE BEGIN
  IF ("Marked for Routing" <> '') THEN BEGIN
    CurrForm."No.".UPDATEFONTBOLD(TRUE);
    CurrForm."No.".UPDATEFORECOLOR(0);
  END ELSE BEGIN
    CurrForm."No.".UPDATEFONTBOLD(FALSE);
    CurrForm."No.".UPDATEFORECOLOR(0);
  END;
END;

Is it correct that I have to do this for every column in my grid? Isn't there a function or something to format the entire row?

Thanks!

/Mikkel

Answers

  • tinoruijstinoruijs Member Posts: 1,226
    mikkelbm wrote:
    Is it correct that I have to do this for every column in my grid? Isn't there a function or something to format the entire row?

    Thanks!

    /Mikkel

    Yes, that's correct. There isn't a function to format the entire row.. :(

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • DaveTDaveT Member Posts: 1,039
    Hi Mikkel,

    Tino is correct there is no function for the row but I can suggest two things.

    1. use a functions to decide the colour and bold e.g.
    CurrForm."No.".UPDATEFONTBOLD( recordbold );
    CurrForm."No.".UPDATEFORECOLOR( recordcolour );
    this work the same way but it save a hugh amount of time if you ever need to change the colour scheme/causes. You then only have to change the functions recordbold and recordcolour instead of going into the trigger of each field

    2. you can use the marked flag on the record ( put a black mark at the start of the row)
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • mikkelbmmikkelbm Member Posts: 4
    Hi again,

    Thanks a lot for your quick response. I will make a function to handle the color and font-weight.

    I'm not only new to Navision, I'm also new to this forum :) - so should I close this thread or something, when I feel my question has been answered?
  • tinoruijstinoruijs Member Posts: 1,226
    You can put (SOLVED) in the subject before the actual subject of the first post when you edit it.

    Welcome on Mibuso! :)

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • mikkelbmmikkelbm Member Posts: 4
    Perfect! Thanks...
Sign In or Register to comment.