Morning Kevin Color.RGB returns an Integer, not an object of type Color
See http://gambasdoc.org/help/comp/gb.qt/color/rgb So I think your SolarCurrent needs to be an integer (Color is a static class mainly for convenience really) Regards, Caveat On Wed, 2011-06-22 at 20:59 -0400, Kevin Fishburne wrote: > The code: > > SolarCurrent = Color.RGB(Convert.Range(HourCurrent, 0, 0.125, > sol_midnightr, sol_dawnr), Convert.Range(HourCurrent, 0, 0.125, > sol_midnightg, sol_dawng), Convert.Range(HourCurrent, 0, 0.125, > sol_midnightb, sol_dawnb), Convert.Range(HourCurrent, 0, 0.125, > sol_midnighta, sol_dawna)) > > Type mismatch: wanted Color got Integer instead > > Color.RGB(Convert.Range(HourCurrent, 0, 0.125, sol_midnightr, > sol_dawnr), Convert.Range(HourCurrent, 0, 0.125, sol_midnightg, > sol_dawng), Convert.Range(HourCurrent, 0, 0.125, sol_midnightb, > sol_dawnb), Convert.Range(HourCurrent, 0, 0.125, sol_midnighta, sol_dawna)) > > by itself returns 520093711, so everything after the = works fine. The > function Convert.Range returns a single, so basically the logic is: > > SolarCurrent = Color.RGB(singleR, singleG, singleB, singleA) > > SolarCurrent is fined as a color: > > Dim SolarCurrent As Color ' Current color of sunlight. > > Any idea what's happening here? Seems like it should just work, so I > must be missing something. > > Just in case it matters, the Convert.Range function looks like this: > > Public Function Range(Range1Value As Single, Range1Minimum As Single, > Range1Maximum As Single, Range2Minimum As Single, Range2Maximum As > Single) As Single > > ' Convert value in range 1 to number in range 2. > > ' Convert and return the value. > Return (((Range1Value - Range1Minimum) * (Range2Maximum - > Range2Minimum)) / (Range1Maximum - Range1Minimum)) + Range2Minimum > > End > > ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user