This almost works

        grid[grid.Rows.Max, 15].Background =
        IIf(IsNull(Choose(cs.Result, Color.Yellow, Color.Green,
        Color.Cyan)), Color.Default, Choose(cs.Result, Color.Yellow,
        Color.Green, Color.Cyan))
        
(where grid is a gridview control (which just happens to have a column
15))

cs.result is an integer value between 1 and 10.  As I load each of the
gridview rows I'd like to highlight cells (in column 15) where the
cs.result value is 1 or 2 or 3.

The code is unwieldy because Choose returns a null if the choose value
is not selectable from the list.

        <WISH> It would be nice if there was some way to include a
        default value if the choose value was not indexable.  Something
        like
        
        grid[grid.Rows.Max, 15].Background = Pick(cs.Result,
        [Color.Yellow, Color.Green, Color.Cyan],Color.Default)
        
        ie Pick(Value as Integer,List as Variant[],Optional Default As
        Variant) As Variant
        </WISH>


But I digress.  Today's irk is demonstrated in the attached project that
just loads a sample gridview using the unwieldy code above.  What has
happened when the Choose value is 4????

There are some comments in the code that may provide some insight.

best regards
Bruce


p.s. Sorry, I cant post this to Issues as I am running a huge db re-org
today and starting firefox grabs too much memory and kills the re-org
task.





<<attachment: Strange \>>

Attachment: 4thplace-0.0.1.tar.gz
Description: application/compressed-tar

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to