I am sure that jacques is right here. The old 256 colour trick in a table.
He even told me about it in readme files ... no excuses really. I will
change the program to suit and post it up to the download site.
THanks to all that have helped.
R
>>>>>>>>>>>
Robert,
I saw this message when I open the machine just before going out again. I
have a possible explanation for your RGB "not working well". If it happens
around the 256th colour in your list, you have fallen victim to MI
limitation of 256 colours per table. If you read some of the texts in the
zip file I sent you, you would have realized that if you want to display
more than 256 colours, you would have to dispatch them on several tables,
then to show them in the same mapper (they will have to tile up properly of
course).
Good luck
Jacques
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Robert
Crossley
Sent: June 3, 2001 8:49 AM
To: MapInfo List
Subject: MI-L MI: Re: Colours and MapBasic BrushStyle question
Thanks all who sent me colour lists with associated RGB styles. If anyone
is interested, I have put them together into a single colour table.
Also I have written a program to generate a colour grid, and is based on the
colour table. But, it has been giving me some grief. I don't normally do
much with brush stryle, so maybe I'm missing something. I have a function
that returns an object of the style specified in the RGBvalue field of a
table.
The print commands embedded in the program show that while in the function,
the rgb of the brush style is as expected. But once it is back in the main
table, it is not the same colour as the object that was returned from the
function.
I will forward the table to anyone interested, or put it on the ftp site,
but need to get the program going first.
R
'_________________________________________________________________
Include "Mapbasic.def"
Declare Sub Main
Declare Function fCreateRect(ByVal Name As String,
Byval Row As Integer,
ByVal Col As Integer,
Byval RGBCode As Integer) As Object
Sub Main
'___________________________________________________
'Opens a table called colourlist, a table that has a
'list of colour descriptors and RGB values.
'Calls a function that updates the object to be a
'rectangle of the colour specified in the RGBValue field
'___________________________________________________
Dim NumberRecs As Integer
Dim ID, Row#, Col#, NumCols As Integer
Close All Interactive
'Open the colourList table and Get Rid of old objects
CLS
Row# = 0
Col# = 0
'Open a table with colour desription and rgb value, delete all objects
Open Table ApplicationDirectory$()+"\ColourList.TAB" Interactive
Drop map ColourList
Create Map For ColourList CoordSys NonEarth Units "cm" Bounds (-1, -1) (500,
500)
'Calculate the position of the square based on its row ID, and update the
'object using the fCreateRect function
Set CoordSys Table ColourList
NumCols = Sqr(TableInfo(ColourList,TAB_INFO_NROWS))
Update ColourList Set obj = fCreateRect(ColourDesc, Int(RowID/NumCols),
RowID Mod NumCols, RGBValue)
'Check colour style of the object
Fetch First From ColourList
Do Until EOT(ColourList)
Print ColourList.RowID + " " +
ColourList.ColourDesc + " " +
ColourList.RGBValue + " " +
StyleAttr(ObjectInfo(ColourList.Obj,OBJ_INFO_BRUSH),BRUSH_FORECOLOR)
Fetch Next From ColourList
Loop
'make a map showing the colour grid
Map From ColourList
set map redraw off
Set Map Zoom Entire Layer 1
Set Map Layer 1 Label Position Center Font ("Arial",256,7,16777215,0) Auto
On
Set Map Layer 1 Label With ColourDesc+Chr$(13)+RGBValue
set map redraw on
End Sub
Function fCreateRect(ByVal Name As String,
Byval Row As Integer,
ByVal Col As Integer,
Byval RGBCode As Integer) As Object
Dim NewObj As Object
'Set the brush style, and create an object on the grid at its position
Set Style Brush MakeBrush(2,RGBCode, WHITE)
Create Rect InTo Variable NewObj
(2*Row, Col) (2*Row+2, Col + 1)
Brush MakeBrush(2,RGBCode, WHITE)
'Print Name + " " +
' Row + " " +
' Col + " " +
' RGBCode + " " +
' StyleAttr(CurrentBrush(),BRUSH_FORECOLOR) + " " +
' StyleAttr(ObjectInfo(NewObj,OBJ_INFO_BRUSH),BRUSH_FORECOLOR)
fCreateRect = NewObj
End Function
Robert Crossley
Whats Here
10 Trinity Street
Parramatta Park
CAIRNS 4870
AUSTRALIA
LAT:16.928569S LONG:145.769107E
Ph 40314877
F 40314810
M 0419 718642
E [EMAIL PROTECTED]
_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.
_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.