Options

Using colours in form fields

RobbieXRobbieX Member Posts: 66
Hi there

I need to try and find the best solution for the following scenario:

We have a header form for each container with a sub-form which represents what is to be loaded onto the container.
There is a Function/Get Sales Order Lines list form, that, when it opens, only lists the Sales Orders for the customer for whom the Container is for.
On the Get Sales Order Lines list, there are flowfields which show how many items from an order line have been loaded onto the present container and how many have been already loaded onto another container.
If the 2 flowfields, loadedQty + alreadyLoadedQty = QtyOnSalesOrder then we'd like to be able to give the line, or a field, a colour, to highlight that it is complete.
Filtering using flowfields seems to be too difficult...I've tried a few ideas without success.
Maybe there is a better solution?
Can anyone advise?

Many thanks....
Robbiex

Answers

  • Options
    Timo_LässerTimo_Lässer Member Posts: 481
    You can change the forecolor and the fontbold property of each control in the trigger OnFormat()
    e. g.:
    GetForeColor() : Integer
    CALCFIELDS(loadedQty,alreadyLoadedQty);
    IF (loadedQty + alreadyLoadedQty) < QtyOnSalesOrder THEN
      EXIT(256 * 127);  // darkgreen
    EXIT(255);  // red
    
    
    GetFontBold() : Boolean
    CALCFIELDS(loadedQty,alreadyLoadedQty);
    EXIT((loadedQty + alreadyLoadedQty) = QtyOnSalesOrder);
    
    
    MyControl - OnFormat(Text : Text[1024])
    CurrForm.MyControl.UPDATEFORECOLOR(GetForeColor);
    CurrForm.MyControl.UPDATEFONTBOLD(GetFontBold);
    
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • Options
    DenSterDenSter Member Posts: 8,304
    If you want to do this for a whole line, you will have to do this for all fields.
  • Options
    RobbieXRobbieX Member Posts: 66
    Hi Timo & Daniel

    That is wonderful....it works perfectly!
    I really appreciate your help!
    Robbiex
  • Options
    dba_akudba_aku Member Posts: 13
    The color set by the ForeColor property causes all rows to be displayed in the specified color so if you want to change all the lines at once you can use the property.
Sign In or Register to comment.