Home > Community > Forums > PCB SKILL > backColor for grid cells

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 backColor for grid cells 

Last post Tue, Mar 18 2014 8:59 PM by eDave. 10 replies.
Started by mikebystedt 18 Mar 2014 03:01 PM. Topic has 10 replies and 512 views
Page 1 of 1 (11 items)
Sort Posts:
  • Tue, Mar 18 2014 3:01 PM

    backColor for grid cells Reply

    I've seen the previous posts about setting the background color for text cells in grids,
    but I cannot get it to work at all.  I can set the foreground text just fine.  The following
    approach is not working at all for me. I even tried adding in the formColorize call.
    All the options so far seem to work so far EXCEPT for the backgrounds.  
    Not only can I not use custom colors from my
    palette, but even the basic 'red 'green 'yellow 'black aren't working.  ALL help is
    greatly appreciated.  This is driving me nuts and I've spent hours fiddling with this
    supposedly simple item.  Thanks, -Mike

    cell->value = "MIKE"
    cell->row = 1
    cell->col  = 1 

    axlFormColorize(form "grid" 'background 'green)

    cell->backColor = 'green

    axlFormSetField(form "grid" cell) 

    • Post Points: 20
  • Tue, Mar 18 2014 3:10 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 717
    • Points 15,550
    Re: backColor for grid cells Reply

    Did you start with

    cell = axlFormGridNewCell()

    Dave Elder, Tait Communications
    • Post Points: 20
  • Tue, Mar 18 2014 4:22 PM

    Re: backColor for grid cells Reply

    Yes. I didn't include all the code.  Basically I can't get the background color to change at all.

    cell = axlFormGridNewCell()

    cell->row = rowCounter

    cell->col = colCounter

    cell->textColor = 'black

    cell->backColor = 'yellow

    cell->value = "Layer"

    axlFormSetField(form "grid" cell)

     

    • Post Points: 35
  • Tue, Mar 18 2014 4:36 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 717
    • Points 15,550
    Re: backColor for grid cells Reply
    Are you on 16.6 Windows?
    Dave Elder, Tait Communications
    • Post Points: 20
  • Tue, Mar 18 2014 4:38 PM

    Re: backColor for grid cells Reply

    Yes I am Dave!  I should have included that earlier.

     

    • Post Points: 5
  • Tue, Mar 18 2014 4:41 PM

    Re: backColor for grid cells Reply
    I'm also having a problem centering the columns during creation.  It always stays to the left.
    • Post Points: 20
  • Tue, Mar 18 2014 4:44 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 717
    • Points 15,550
    Re: backColor for grid cells Reply
    Works for me... (See attachment)
    Dave Elder, Tait Communications
    • Post Points: 20
  • Tue, Mar 18 2014 4:47 PM

    Re: backColor for grid cells Reply
    Any chance you can send me the code snippet? I must be missing something here... Thanks! -Mike
    • Post Points: 5
  • Tue, Mar 18 2014 4:50 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 717
    • Points 15,550
    Re: backColor for grid cells Reply

    Don't forget axlFormGridUpdate(form, "grid")

    Take a look at the example fgrid.il (.....\share\pcb\examples\skill\form\grid\fgrid.il)

    Dave Elder, Tait Communications
    • Post Points: 20
  • Tue, Mar 18 2014 7:30 PM

    Re: backColor for grid cells Reply

    Hey Dave, Thank you for your help.  I've put in multiple calls to axlFormGridUpdate(form "grid").
    I've simplified some code as an example.  But I still can not get the background
    color or alignment to work.  Would you (or ANYBODY) take a look?  After loading these procedures and calling mikeGrid()
    it should open up a form with 5 columns and 10 rows.  Then it should enter in the centered text "MIKE" in red with a
    background color of yellow...  Huge thanks again all...  -Mike

    ==================================================================== 

    procedure( mikeGrid()

      let(( formFile      )

      

        formFile = "./legend.file"

    generateLegendFormFile(formFile)

    LegendForm = axlFormCreate( (gensym) formFile nil 'legend_form_Action t)

    legendForm()

    axlFormGridUpdate(LegendForm "grid")

      

      );End let.

    );End mikeGrid().

     

    procedure( legend_form_Action(legend_form)

      let((   )

    printf("Mike: Calling legend_form_Action()...\n")

      )

    )

     

    procedure( generateLegendFormFile(fileName)

      let(( )

    outputFile = outfile(fileName)

    fprintf(outputFile "FILE_TYPE=FORM_DEFN VERSION=2\n")

    fprintf(outputFile "FORM\n")

    fprintf(outputFile "FIXED\n")

    fprintf(outputFile "PORT 80 20\n")

    fprintf(outputFile "HEADER \"Legend - Oracle\"\n")

    fprintf(outputFile "TILE\n")

    fprintf(outputFile "#======================\n")

    fprintf(outputFile "GRID grid\n")

    fprintf(outputFile "FLOC 2 1\n")

    fprintf(outputFile "FSIZE 78 30\n")

    fprintf(outputFile "OPTIONS INFO HLINES VLINES\n")

    fprintf(outputFile "ENDGRID\n")

     

    ;===========================================================

    ; Finish the end of the Form file.

    ;===========================================================

    fprintf(outputFile "#======================\n")

    fprintf(outputFile "FLEXMODE edgegravity\n")

    fprintf(outputFile "FLEX grid 0 0 1 1\n")

    fprintf(outputFile "ENDTILE\n")

    fprintf(outputFile "ENDFORM\n") 

     

    close(outputFile)

      

      );End let.

    );End generateLegendFormFile.

     

     

    procedure( legendForm()

      let(( c cell     )

      

    c = make_formGridCol()

    c->fieldType = 'TEXT

    c->colWidth = 1

    c->align 'center

    c->headText = "Text"

    c->scriptLabel = nil ; restore rest of columns back to scripting column number

    for(i 1 5 ;Add 5 columns.

    axlFormGridInsertCol(LegendForm "grid" c)

    )

        axlFormGridInsertRows(LegendForm "grid" 1 10) ;;Add 10 rows.

        axlFormGridUpdate(LegendForm "grid")

    axlFormDisplay(LegendForm)

    cell = axlFormGridNewCell() ;;Add in a value for a cell.

    cell->row = 1

    cell->col = 1

    cell->textColor = 'red

    cell->backColor = 'yellow

    cell->value = "MIKE"

    axlFormSetField(LegendForm "grid" cell)

    axlFormGridUpdate(LegendForm "grid")

      

      );End let.

    );End legendForm().

     ==========================================================================

    • Post Points: 20
  • Tue, Mar 18 2014 8:59 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 717
    • Points 15,550
    Re: backColor for grid cells Reply

    Hi MIke,

    I took me a while but you have designed the form with an "INFO" option. Remove that and put an "=" before 'center and you should be good.

     CHeers,
    Dave 

    Dave Elder, Tait Communications
    • Post Points: 5
Page 1 of 1 (11 items)
Sort Posts:
Started by mikebystedt at 18 Mar 2014 03:01 PM. Topic has 10 replies.