Page 2 of 2

Re: Change datagrid backgroundcolor for a row from code

Posted: Sat May 10, 2014 9:56 am
by Nicke
Hi,

the reset also resets the active hilite so that is not an option. I tried with the lighter green background color but at least on a linux machine there is no different (look at the screenshot)

Image

I have to investigate the background color opacity but besides that you have solved my problem, thank you Simon!

BR
Nicke

Re: Change datagrid backgroundcolor for a row from code

Posted: Thu May 15, 2014 11:04 am
by Nicke
Ok, I'm back to square one. The code I thought was working is not working as I need.

Code: Select all

on mouseUp
   repeat with x = 1 to 4
      set the opaque of field ("Col" && x &&  "0002") of grp "DG1" to true
      set the backgroundColor of field ("Col" && x &&  "0002") of grp "DG1" to "green"
   end repeat
end mouseUp
This will change the background color on row 2 but when I scroll down the "next" line 2 that is outside the area I can see it is also green. So "0002" seems to be tied to the "view area" not the actual line of the datagrid. Using backgroundcolor with opaque also makes the "hilite bar" of the selected line to be under the background color (see post above).

So I would like to have the background of one chosen datagrid line to be colored in the same way as "Alternate Row Colors" works and still be able to use the datagrid as normally.

Is this possible at all?

Re: Change datagrid backgroundcolor for a row from code

Posted: Thu May 15, 2014 11:51 am
by keram
Hi Nicke,
Nicke wrote:So "0002" seems to be tied to the "view area" not the actual line of the datagrid.
I had a similar problem with a DG I'm working on and solved it by adding a fixed number to each row in the data before I populated the DG. Then that number I used as a reference in various views I wanted to select from the DG.
I'm not completely sure how you are getting your DG populated but you could try the above.

keram

Re: Change datagrid backgroundcolor for a row from code

Posted: Tue May 20, 2014 9:53 am
by Nicke
Hi keram,

thanks I have to take a look at that approach, but I still have to figure out how to color the wanted line so that the hilite is still visible...

Re: Change datagrid backgroundcolor for a row from code

Posted: Fri May 23, 2014 7:53 am
by Nicke
The solution to my problem is found here http://forums.runrev.com/viewtopic.php?f=8&t=20455