Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: CELL ATTRIBUTES  (Read 3697 times)
Benjamin G.
Posts: 130


« on: February 26, 2024, 12:14:00 pm »

Hi,

Cell color attributes  (https://4js.com/techdocs/fjs-fgl-manual/#fgl-topics/c_fgl_prog_dialogs_cell_attr.html) permits to change the background color of the cell but how can we also change de "text color", "decoration", "fontweigth" of the cell ...
A syntax of the cell attribute string could be :  LET mycellcolor[x] = "#F7CAC9 REVERSE | #000000 BOLD UNDERLINE", first part the cell color and second part the atributes (color, fontweigth, decoaration) of the "text"
Playing with  ligth and dark themes this feature will be usefull

Regards
Reuben B.
Four Js
Posts: 1116


« Reply #1 on: February 26, 2024, 11:04:53 pm »

Hi Benjamin,

Please avoid linking to the Early Access Program documentation, you link should be to https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_prog_dialogs_cell_attr.html

TTY attributes have their origins in terminals and Text User Interfaces.  As per the method documentation, https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_ClassDialog_setCellAttributes.html , "The reverse attribute: When a color is specified, it is used as background color instead of foreground text color".  So if you say "red", the text color will be red, if you say "red reverse", the background color will be red, the text color will be unchanged.  Also due to their terminal origins, we discourage their use moving forward https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_MigI4GL_040.html

This is an interesting article around terminal colors.  https://misc.flogisoft.com/bash/tip_colors_and_formatting and in that it says you can change both foreground and reverse colors. At command line

Code
  1. echo -e "\e[1;33;44m Yes it is awful \e[0m"
  2. echo -e "\e[1;34;43m Yes it is awful \e[0m"

and you will see yellow on blue and blue on yellow.

Based on that, you could argue that there could be a 4gl syntax in TTY attributes that allowed the passing of two colors, one foreground, one background.  This has been considered before and is task FGL-4296.  It never made it into the product.  Insufficient demand to meet the cost of implementing.  Also TTY attributes is not the way forward and is not something we would invest in out of choice.

I tend to use HTML to avoid TTY attributes, see the screenshot near the end of this article https://4js.com/ask-reuben/ig-28/    note how I have white text on the darker colors, and black text on the lighter colors.  That technique is over for read only fields, not necessary what you want fo editable fields.

Personally I'd prefer the ability to set styles in setCellAttributes but that has been on the wish list for a long time, note the date in ... https://4js.com/support/issue/?id=FGL-01470.

Ask your support contact to get yourself added to either FGL-4296 or FGL-1470 so that the appropriate demand is captured.

For the issue you raised about light/dark themes, your concern is a valid one.  Note the hint I gave in the Feature of the Day article in the EAP and I would suggest creating a topic of conversation in the EAP.

Reuben


Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Sebastien F.
Four Js
Posts: 545


« Reply #2 on: February 27, 2024, 07:32:19 am »

Reuben,

You wrote:
Quote
Also due to their terminal origins, we discourage their use moving forward https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_MigI4GL_040.html

The intention of this migration topic was to suggest the review of TUI-specific code using "TTY attributes", in favor to Genero BDL style attributes, to simplify the code.

However, while DIALOG.setCellAttributes() is based on "TTY attributes", it is legal and fully supported with with Genero BDL.

We should try to find a way to specify both the text and the background color of a cell.
Using style attributes would be the natural solution, but there is a risk of performance issues.

Seb
Benjamin G.
Posts: 130


« Reply #3 on: February 27, 2024, 08:53:33 am »

Hi,

I'm agree with Seb. Using the setCellAttributes would be a better place if we could specify "rich" information (background color, textcolor , ...)
See my sample here, i need to find a cell attribute color that works for the "black theme" (text color is white) and "ligth theme" (text color is black)
Here is the code (note that cwcrLila and cwcrVert  colors are initialized with a different value depending the choosed theme, se code below)


    DISPLAY ARRAY oMrgprx.v TO sr_mrgprx.* ATTRIBUTES(KEEP CURRENT ROW=TRUE, FOCUSONFIELD)
      BEFORE DIALOG 
         CALL DIALOG.setArrayAttributes('sr_mrgprx'   ,oMrgprx.a)      BEFORE DISPLAY
      BEFORE ROW
        LET p = arr_curr()
        LET oMrgprx.a[p].ancdatprx01 = cwcrLila || ' REVERSE BOLD'
        LET oMrgprx.a[p].ancpxaref01 = cwcrLila || ' REVERSE BOLD'
        LET oMrgprx.a[p].ancpxvstd01 = cwcrLila || ' REVERSE BOLD'
        LET oMrgprx.a[p].ancpxvqte01 = cwcrLila || ' REVERSE BOLD'
        LET oMrgprx.a[p].ancqtemin01 = cwcrLila || ' REVERSE BOLD'
        LET oMrgprx.a[p].noudatprx01 = cwcrVert || ' REVERSE BOLD'
        LET oMrgprx.a[p].noupxaref01 = cwcrVert || ' REVERSE BOLD'
        LET oMrgprx.a[p].noupxvstd01 = cwcrVert || ' REVERSE BOLD'
        LET oMrgprx.a[p].noupxvqte01 = cwcrVert || ' REVERSE BOLD'
        LET oMrgprx.a[p].nouqtemin01 = cwcrVert || ' REVERSE BOLD'
      AFTER ROW
        LET oMrgprx.a[p].ancdatprx01 = ''
        LET oMrgprx.a[p].ancpxaref01 = ''
        LET oMrgprx.a[p].ancpxvstd01 = ''
        LET oMrgprx.a[p].ancpxvqte01 = ''
        LET oMrgprx.a[p].ancqtemin01 = ''
        LET oMrgprx.a[p].noudatprx01 = 'BOLD'
        LET oMrgprx.a[p].noupxaref01 = 'BOLD'
        LET oMrgprx.a[p].noupxvstd01 = 'BOLD'
        LET oMrgprx.a[p].noupxvqte01 = 'BOLD'
        LET oMrgprx.a[p].nouqtemin01 = 'BOLD'

---INIT COLORS ...

  CALL ui.Interface.frontCall("theme", "getCurrentTheme",[], [gbctheme])
  CALL ui.Interface.frontCall("standard", "feInfo", ["colorscheme"], [colorscheme])
  IF colorscheme = 'dark' OR gbctheme.getIndexOf('_dark',1) > 0 THEN
    CALL initColors_dark()  -- invertit color (#FFFFFF - base color)
  END IF



* Capture_4js_light.jpg (49.97 KB, 666x340 - viewed 939 times.)
Benjamin G.
Posts: 130


« Reply #4 on: February 27, 2024, 08:54:34 am »

... forgot the black theme sample


* Capture_4js_black.jpg (52.12 KB, 681x393 - viewed 939 times.)
Benjamin G.
Posts: 130


« Reply #5 on: February 27, 2024, 08:58:18 am »

... also note that i've put the "before dialog" in the display array but you know that is part of the DIALOG instruction
Sebastien F.
Four Js
Posts: 545


« Reply #6 on: February 27, 2024, 09:19:43 am »

Hi,

This is not "return to simplicity" or "low code", as we try to sell it.

We should consider TTY attributes as decorations hints that end up as real CSS styles/colors, and my expectation is that the TTY colors could be interpreted differently, depending on the GBC theme used.

You should not have to adapt the attributes used in DIALOG.setCellAttributes() to the GBC theme: These should be adapted automatically and configurable with GBC customization. But I am not the expert for this and not sure it's possible.

Please contact the support to clarify this possibility.

Seb
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines