Announcement

Collapse
No announcement yet.

sc_field_style

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • sc_field_style

    Hello,

    I think there is a bug in sc_field_style macro:
    sc_field_style({field1}, {filed2});
    or
    sc_field_style({field1}, $variable1);
    don't works...
    Gökhan Sönmez

  • #2
    have you tried:

    sc_field_style(field1, {filed2});
    or
    sc_field_style(field1, $variable1);


    ?
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Hello,

      Issue reported to our bugs team.

      regards,
      Bernhard Bernsmann

      Comment


      • #4
        Hello,

        As I initially thought sc_field_style does not accept variables as parameter.

        regards,
        Bernhard Bernsmann

        Comment


        • #5
          Hello, I'm pretty new to the forum and to scriptcase, and I know it's pretty old thread/topic.
          However in my attempts to have sc_field_style to work with dynamic parameters, I have found a way to do that I wanted to share ( and sorry if there's better options )
          I'm using Scriptcase 9.xxx. This results from study of the generated PHP code for my application.

          First, I have a lookup function created to retrieve my parameters :

          PHP Code:
          function getColorFromCode ($Code)
          {
          $SQL "SELECT * FROM ADM_CODE_COLOR WHERE COLORCODE_UID = ".$Code;
          sc_lookup(res,$SQL);

          if (!empty(
          $res)) {
          $foreColor $res [0][2];
          $backColor $res [0][3];
          $fontSize $res [0][4];
          } else {
          $foreColor "#000000";
          $backColor "#FFFFFF";
          $fontSize "15px";
          }

          $style "background-color:".$backColor.";font-size:".$fontSize.";color:".$foreColor.";";
          return 
          $style;

          That creates and returns the style entries I'm looking for.
          In the grid onRecord events, I have the following :

          PHP Code:
          1. $st getColorFromCode($dt);
          2. sc_field_style({DATE_RATIO},[backColor],[fontSize],[foreColor]);
          3. $this->NM_field_style["date_ratio"]=$st
          Code details :
          1. retrieves my style string.
          2. the 'not working' call to the function is however required ( for all sorts of initialisations in Scriptcase )
          3. I'm simply overwritting the style elements for the field I'm looking for.


          Hope it helps
          Last edited by FredWalker; 04-10-2018, 05:24 PM.

          Comment

          Working...
          X