Re: Color question



On Wed, 31 Mar 2004, kadil wrote:
I have an appthat is reading data from an odbc database and drawing the
results on a drawing area. One line drawn per row returned. Table data as
follows:

Start_of_line         End_Of_Line     Color
0                     10                      565466
10                    17                      99094
17                    42                      255

One of the columns returned is a color. So I want to draw the each rectangle
colored as per the record. When I try to change the color, it changes the
color of all the previous rectangles that I have drawn. Do I need to define a
separate color for each possible color option?
Hi kadil,
it's not clear to me how you draw your rectangles in detail. What you
should do is:
- invalidate your drawing area when your data changes, so that an
  expose-event is generated (gtk_widget_queue_draw_area)
- in the expose-event handler:
  - set draw color
  - draw a rectangle
  - set next draw color
  - draw next rectangle
  and so on

You should decide yourself whether you read data from the database every
time an expose-event occurs or rather cache them in own data structures
inside your program.

Regards,
                         Peter
-- 
====================================================================
Peter Krüger

applied software solutions (appss) GmbH
Sandtorstr. 23
D-39106 Magdeburg
Germany

Phone:  +49-(0)391-54486-19388
Fax:    +49-(0)391-54486-19222
email:  krueger appss de
URL:    http://www.appss.de

Managing Director: Uwe Hess, Dietmar Schäfer
Register: HRB12386, AG Mageburg

"Virtual business becomes reality!"

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
====================================================================




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]