the program reads mysql and writes to the grid
how to define a DYNAMICBACKCOLOR to coloring rows, like residents > 15,000,000
how referenced this field for examine
thank you
p.s. in config.ini is connection setting, just edit with notepad/notepad++ or same
dynamicbackcolor in grid, how?
Moderator: Rathinagiri
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
dynamicbackcolor in grid, how?
- Attachments
-
- grid.zip
- (16.89 KiB) Downloaded 198 times
- serge_girard
- Posts: 3165
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: dynamicbackcolor in grid, how?
Hello Dragan,
I use this construction:
In BC_Grid_1() you can place any kind of condition in order to color any field.
Greetings, Serge
I use this construction:
Code: Select all
Grid:
DYNAMICBACKCOLOR { { || BC_Grid_1()},{||BC_Grid_1()},{||BC_Grid_1()},{||BC_Grid_1()},{||BC_Grid_1()} } // each column needs a call to BC_Grid_1()
FUNCTION BC_Grid_1()
/**************************/
LOCAL a
LOCAL aColors := {{ WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, ;
WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, ;
WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, ;
WHITE ,WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE } } // EQUAL TO NUMBER OF COLUMNS == 32
LOCAL aItem := Form_1.Grid_1.Item ( This.CellRowIndex )
IF aItem [30] == 'X'
FOR a = 1 TO 32
aColors [1] [a] := MISTYROSE
NEXT a
ENDIF
IF aItem [31] == '='
FOR a = 1 TO 32
aColors [1] [a] := LAVENDER
NEXT a
ENDIF
IF val(aItem [32]) > 0 // GROUP
FOR a = 1 TO 32
aColors [1] [a] := HONEYDEW
NEXT a
ENDIF
RETURN aColors [1] [ This.CellColIndex ]
Greetings, Serge
There's nothing you can do that can't be done...
- serge_girard
- Posts: 3165
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: dynamicbackcolor in grid, how?
Dragan,
I made a change in your mysqlfn.prg in order to get it working:
I made a change in your mysqlfn.prg in order to get it working:
Code: Select all
If AScan( aDatabaseList, (_Database) ) == 0 // removed Lower !!!!
MsgINFO( "Database " + _Database + " doesn't exist!")
Return Nil
EndIf
There's nothing you can do that can't be done...
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: dynamicbackcolor in grid, how?
Thank you Serge