I am building TCanvas....
Cliff

Mailing lists / lazarus / 1999-07
53 messages · 9 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
I am building TCanvas....
Cliff
Anyone have any detail on how I would go about writing to the canvas or drawing area of a gtkwidget without using the drawingarea widget?
I know I can get a gdkwindow from doing
fWindow := PgdkWindow(pgtkwidget(widget)^.window); but what do I do with that window? I can get it's gdkgc but I don't have ANY idea what to do.
Thanks
Shane
Looking at it I thought this would work:
Create a pixmap and draw on it. The pixmap I then store using
gtk_object_set_data(pgktobject(widget),'Pixmap',pixmap);Here's the basic code.
widget : pgtkwidget;
pixmap : pgdkPixMap;
TheStyle : pgtkstyle;
begin
widget := pgtkwidget(gtkwindow);
pixmap := gtk_object_Get_data(pgktobject(widget),'Pixmap');
gdk_window_clear(widget^.window);
TheStyle := pgtkwidget(widget)^.thestyle;
gdk_draw_rectangle(pixmap,TheStyle^.white_gc,1,1,1,30,30);
gdk_window_set_back_pixmap(widget^.window,pixmap,1);
gtk_object_set_data(pgktobject(widget),'Pixmap',pixmap);
end;Anyone know why it doesn't seem to do anything?
Shane
>> "Shane Miller" 07/20 8:17 AM >>>
Anyone have any detail on how I would go about writing to the canvas or drawing area of a gtkwidget without using the drawingarea widget?
I know I can get a gdkwindow from doing
fWindow := PgdkWindow(pgtkwidget(widget)^.window); but what do I do with that window? I can get it's gdkgc but I don't have ANY idea what to do.
Thanks
Shane
_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus
Anyone look at the TCAnvas source? Any help please!!!!!
Shane
>> "Shane Miller" 07/20 9:42 AM >>>
Looking at it I thought this would work:
Create a pixmap and draw on it. The pixmap I then store using
gtk_object_set_data(pgktobject(widget),'Pixmap',pixmap);Here's the basic code.
widget : pgtkwidget;
pixmap : pgdkPixMap;
TheStyle : pgtkstyle;
begin
widget := pgtkwidget(gtkwindow);
pixmap := gtk_object_Get_data(pgktobject(widget),'Pixmap');
gdk_window_clear(widget^.window);
TheStyle := pgtkwidget(widget)^.thestyle;
gdk_draw_rectangle(pixmap,TheStyle^.white_gc,1,1,1,30,30);
gdk_window_set_back_pixmap(widget^.window,pixmap,1);
gtk_object_set_data(pgktobject(widget),'Pixmap',pixmap);
end;Anyone know why it doesn't seem to do anything?
Shane
>> "Shane Miller" 07/20 8:17 AM >>>
Anyone have any detail on how I would go about writing to the canvas or drawing area of a gtkwidget without using the drawingarea widget?
I know I can get a gdkwindow from doing
fWindow := PgdkWindow(pgtkwidget(widget)^.window); but what do I do with that window? I can get it's gdkgc but I don't have ANY idea what to do.
Thanks
Shane
_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus
_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus
Looking at it I thought this would work: Create a pixmap and draw on it. The pixmap I…
Shane,
You might take a look at the code in the gtk/examples directory for the program called scribble-simple.pp. It has a bunch of drawing code in it. It might provide some insight to what you are trying to do.
Thanks...Curtis
----------------------------------
Curtis White
Curtis White
http://www.teleport.com/~osiriz/
----------------------------------
I am going to try and code some native gtk stuff tonight to get the answer for shane hopefully.
Cliff
that is what may be happening with shanes code also. I was running some gdk code against widgets last night. The calls are working not throwing errors from gtk but they are not doing what is expected.
Shane try making that call against something like a frame or a panel. How about running the code against the fixed widget pasted to the form.
Cliff
I HATE how GTK handles colors.....
OK, I simply don't understand it, that's why I hate it.
If I use gdk_draw_rectangle() how do I change the color of the rectangle? If you know the answer, please include a little code.
Shane
>> "Shane Miller" 07/21 11:59 AM >>>
Hey, guess what I got the CANVAS to work by writing DIRECTLY to the gdkwindow.....
I will have further details after I get done celebrating!!!!!!!!!!!!!!!
Shane
_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus
I have been sticking with the examples under GTK, and have found some problems with scribble-simple (section 23) that I belive are with the GDK port to FPC.
I have placed debugging writes in pascal and printfs in C, and am getting very different numbers.
I was specifically looking at (PGdkEventExpose)Event^.area.height in the expose_event function
& (PGdkEventMotion)Event^.state in motion_notify_event
I need some help beyond this point!!!
Tom
I have a little project that displays the tcanvas draw rectangle problem.
Cliff
ok share?
cliff
I was sent a initial offering by RedHat why I have no idea. It said that I was a important member of the Open Source community. Because of this I was offered a inital investment opportunity. They said that a certain number of shares are held for this purpose and that that money will be the first invested on the offering date. Don't ask me how RedHat singled myself or others out because I have no trades for this offering have to be done under my account which etrade has on record.
Public date I believe should be around moday.
Cliff
Ok, it looks like the GTKFixed widget was hiding my drawings. I decided to draw to the…
Exciting stuff! Good work.
I have been sticking with the examples under GTK, and have found some problems with…
We have noticed this bug, and the problem is a compiler bug; the pascal compiler aligns the sub-records differently than C does; when accessing records generated By C routines, this of course gives a problem;
specifically the EventExpose.area suffers from this problem;
we are working on it. When it is fixed, we'll let you know.It is possible that this is at the basis of the whole TCanvas problem, but I would have to investigate that.
As a workaround you can typecast the whole thing to a array of word;
words 6,7,8,9 are then the elements of the 'area' sub-record.Not all records suffer from this problem, just records with sub-records that have elements of size <4 in them before the sub-record.
As soon as there is any news about this, I'll let you know.
Michael.
I was sent a initial offering by RedHat why I have no idea. It said that I was a…
There was also something about this on /.
http://slashdot.org/article.pl?sid=99/07/20/2129218&mode=thread
Not anymore I fixed that problem. I am going to post a message to the gtk devloper list.…
Cliff" wroteNot anymore I fixed that problem.
See, I thought I might not know what I was talking about. :-) Good glad you fixed this.
I am going to post a message to the gtk devloper list.
Is it actually a gtk problem?
BTW I also placed a grand into RedHat Software for stock prior to going public in a few days. I now have a vested interest "my money" in linux development.
Wow. You mean you actually have a grand lying around to invest in something? Lucky you. ;-)
I have been sticking with the examples under GTK, and have found some problems with…
I believe this is something that Shane reported a day ago or so. I guess we need to look at the gtk port code.
This brings up a important thing also. Last night I was thinking if we get it to work that means we can draw just about anything on any control we wish. That will make stuff like speed button and such easy.
Cliff
Not anymore I fixed that problem.
I am going to post a message to the gtk devloper list.
BTW I also placed a grand into RedHat Software for stock prior to going public in a few days. I now have a vested interest "my money" in linux development.
Cliff
Ok, it looks like the GTKFixed widget was hiding my drawings. I decided to draw to the gtkfixed widget instead andf that worked. Simple solution but it took forever to figure out.
I guess I thought that the gtkfixed widget wasn't a visual one. Hopefully I wiull have something soon to show everyone...
Shane
>> "Baeseman, Cliff" 07/21 12:54 PM >>>
ok share?
cliff
the specific examples are provided below: The print statements are included to show the problem.
Tom
------------------------------------------------------ /* example-start scribble-simple scribble-simple.c */
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version. *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details. *
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
compile under linux using
gcc `gtk-config --cflags` scribble-simple.c -o scribble-simple `gtk-config --libs`
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
*/
#include <gtk/gtk.h>
/* Backing pixmap for drawing area */
static GdkPixmap *pixmap = NULL;
/* Create a new backing pixmap of the appropriate size */
static gint
configure_event (GtkWidget *widget, GdkEventConfigure *event)
{
if (pixmap)
gdk_pixmap_unref(pixmap);
pixmap = gdk_pixmap_new(widget->window,
widget->allocation.width,
widget->allocation.height,
-1);
gdk_draw_rectangle (pixmap,
widget->style->white_gc,
TRUE,
0, 0,
widget->allocation.width,
widget->allocation.height);
return TRUE;
}
/* Redraw the screen from the backing pixmap */
static gint
expose_event (GtkWidget *widget, GdkEventExpose *event)
{
printf("Expose Event: x= %d y= %d W= %d H= %d \n",
(gint)event->area.x,(gint)event->area.y,
(gint)event->area.width, (gint)event->area.height);
gdk_draw_pixmap(widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
pixmap,
event->area.x, event->area.y,
event->area.x, event->area.y,
event->area.width, event->area.height);
return FALSE;
}
/* Draw a rectangle on the screen */
static void
draw_brush (GtkWidget *widget, gdouble x, gdouble y)
{
GdkRectangle update_rect;
update_rect.x = x - 5;
update_rect.y = y - 5;
update_rect.width = 10;
update_rect.height = 10;
gdk_draw_rectangle (pixmap,
widget->style->black_gc,
TRUE,
update_rect.x, update_rect.y,
update_rect.width, update_rect.height);
gtk_widget_draw (widget, &update_rect);
}
static gint
button_press_event (GtkWidget *widget, GdkEventButton *event)
{
if (event->button == 1 && pixmap != NULL)
draw_brush (widget, event->x, event->y);
return TRUE;
}
static gint
motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
{
int x, y;
GdkModifierType state;
if (event->is_hint)
gdk_window_get_pointer (event->window, &x, &y, &state);
else
{
x = event->x;
y = event->y;
state = event->state;
}
printf ("Motion_notify_event: state= %d mask=
%d\n",(gint)state,(gint)GDK_BUTTON1_MASK);
if (state & GDK_BUTTON1_MASK && pixmap != NULL)
draw_brush (widget, x, y);
return TRUE;
}
void
quit ()
{
gtk_exit (0);
}
int
main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *drawing_area;
GtkWidget *vbox;
GtkWidget *button;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (window, "Test Input");
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show (vbox);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (quit), NULL);
/* Create the drawing area */
drawing_area = gtk_drawing_area_new ();
gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
gtk_widget_show (drawing_area);
/* Signals used to handle backing pixmap */
gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
(GtkSignalFunc) expose_event, NULL);
gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event",
(GtkSignalFunc) configure_event, NULL);
/* Event signals */gtk_signal_connect (GTK_OBJECT (drawing_area),
"motion_notify_event",
(GtkSignalFunc) motion_notify_event, NULL);
gtk_signal_connect (GTK_OBJECT (drawing_area),"button_press_event",
(GtkSignalFunc) button_press_event, NULL); gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
/* .. And a quit button */
button = gtk_button_new_with_label ("Quit");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (window));
gtk_widget_show (button);
gtk_widget_show (window);
gtk_main ();
return 0;
}
/* example-end */
---------------------------------------------------------------
program scribblesimple;
uses
glib,Gdk,Gtk;
{ Backing pixmap for drawing area }
const
pixmap : PGdkPixmap = NIL;
{ Create a new backing pixmap of the appropriate size }
function configure_event (widget : PGtkWidget; event:
PGdkEventConfigure): gint; cdecl;
begin
if pixmapNIL then
gdk_pixmap_unref(pixmap);
pixmap := gdk_pixmap_new(widget^.window,
widget^.allocation.width,
widget^.allocation.height,
-1);
writeln('Got to configure_event');
if pixmap = Nil then writeln('Nil Pixmap');
gdk_draw_rectangle (pixmap,
PGtkStyle(widget^.thestyle)^.white_gc,
gint(true),
0, 0,
widget^.allocation.width,
widget^.allocation.height);
configure_event := ord(TRUE);
end;
{ Redraw the screen from the backing pixmap }
function expose_event (widget : PGtkWidget ; event :
PGdkEventExpose ) : gint; cdecl;
begin
writeln('Expose_event: x =',event^.area.x,' y= ',event^.area.y,
' width= ',event^.area.width,' height=
',event^.area.height);
if pixmap = Nil then writeln('Nil Pixmap');
gdk_draw_pixmap(widget^.window,PGtkStyle(widget^.thestyle)^.fg_gc[gtk_WIDGET_STATE (widget)], pixmap,
event^.area.x, event^.area.y,
event^.area.x, event^.area.y,
event^.area.width, event^.area.height);
expose_event:= ord(FALSE);
end; { Draw a rectangle on the screen }
procedure draw_brush (widget : PGtkWidget ; x, y: gint16);
var update_rect : TGdkRectangle;
begin
update_rect.x := x - 5;
update_rect.y := y - 5;
update_rect.width := 10;
update_rect.height := 10;
if pixmap = Nil then
writeln('The style
',PGtkStyle(widget^.thestyle)^.white_gc^.dummy_var);
gdk_draw_rectangle (pixmap,
PGtkStyle(widget^.thestyle)^.black_gc,
gint(true),
update_rect.x, update_rect.y,
update_rect.width, update_rect.height);
gtk_widget_draw (widget, @update_rect);
end;
function button_press_event (widget : PGtkWidget ; event:
PGdkEventButton ) : gint; cdecl;
begin
writeln('Got to button_press_event');
if pixmap = Nil then writeln('Nil Pixmap');
if (event^.button = 1) and (pixmap NIL) then begin
draw_brush (widget, trunc(event^.x), trunc(event^.y));
end;
button_press_event := ord(TRUE);
end;
function motion_notify_event (widget : PGtkWidget ; event:
PGdkEventMotion ) : gint; cdecl;
var x, y : gint ;
state : guint;
begin
if pixmap = Nil then writeln('Nil Pixmap in motion_notify_event');
if (event^.is_hint0) then begin
gdk_window_get_pointer (event^.window, @x, @y, @state);
end else begin
x := trunc(event^.x);
y := trunc(event^.y);
state := event^.state;
end;
writeln('Motion_notify_event: state = ',state,' mask=
',gdk_BUTTON1_MASK);
//if ((state {and gdk_BUTTON1_MASK)<}>0) and (pixmap NIL) then
if (state >0) and (pixmap NIL) then
begin
//writeln('Continue to draw');
draw_brush (widget, x, y);
end;
motion_notify_event := ord(TRUE);
end;
procedure quit;
begin
gtk_exit (0);
end;
var window, drawing_area, vbox, button : PGtkWidget;
begin
gtk_init (@argc, @argv);
//gtk_rc_init;
window := gtk_window_new (gtk_WINDOW_TOPLEVEL);
gtk_widget_set_name (window, 'Test Input');
vbox := gtk_vbox_new (false, 0);
gtk_container_add (PGtkCONTAINER (window), vbox);
gtk_widget_show (vbox);
gtk_signal_connect (PGtkOBJECT (window), 'destroy',
gtk_SIGNAL_FUNC (@quit), NIL);
{ Create the drawing area }
drawing_area := gtk_drawing_area_new ();
gtk_drawing_area_size (PGtkDRAWINGAREA (drawing_area), 200, 200);
gtk_box_pack_start (PGtkBOX (vbox), drawing_area, true, true, 0);
gtk_widget_show (drawing_area);
{ Signals used to handle backing pixmap }
gtk_signal_connect (PGtkOBJECT (drawing_area), 'expose_event',
gtk_SIGNAL_FUNC (@expose_event), NIL);
gtk_signal_connect (PGtkOBJECT(drawing_area),'configure_event',
gtk_SIGNAL_FUNC (@configure_event), NIL);
{ Event signals }gtk_signal_connect (PGtkOBJECT (drawing_area),
'motion_notify_event',
gtk_SIGNAL_FUNC (@motion_notify_event), NIL);
gtk_signal_connect (PGtkOBJECT (drawing_area),'button_press_event',
gtk_SIGNAL_FUNC (@button_press_event), NIL); gtk_widget_set_events (drawing_area, gdk_EXPOSURE_MASK
or gdk_LEAVE_NOTIFY_MASK
or gdk_BUTTON_PRESS_MASK
or gdk_POINTER_MOTION_MASK
or gdk_POINTER_MOTION_HINT_MASK);
{ .. And a quit button }
button := gtk_button_new_with_label ('Quit');
gtk_box_pack_start (PGtkBOX (vbox), button, false, false, 0);
gtk_signal_connect_object (PGtkOBJECT (button), 'clicked',
gtk_SIGNAL_FUNC (@gtk_widget_destroy),
PGtkOBJECT (window));
gtk_widget_show (button);
gtk_widget_show (window);
gtk_main ();
end.gdk_set_foreground(window,gc,color)
something to that effect. the definition id in gdkmain.pp
Cliff
Hey, guess what I got the CANVAS to work by writing DIRECTLY to the gdkwindow.....
I will have further details after I get done celebrating!!!!!!!!!!!!!!!
Shane
I fixed that problem and will update CVS later.
The setbounds was BEFORE the create component call.
Shane
>> "Michael A. Hess" 07/21 9:43 AM >>>
Shane Miller wroteOK, I changed my fillrect procedure to do the following, but it still doesn't show up!....
Shane I don't know if this is related or not. I haven't had a chance to look at your TCanvas code so if not just ignore me.
When I created the hello_world application I noticed something strange. I place the button on the from and just let it us the default sizes that are set when the button is created.
The button didn't show. It would be drawn on the form.
The only way I could get the button to draw on the form was to CHANGE the top,left,width,height after the button was created. Then an only then would the button be drawn. This needs to be looked at anyway but maybe it is related to your problem of things not showing up.
OK, I changed my fillrect procedure to do the following, but it still doesn't show up!....
Procedure TgtkObject.DrawFillrect(Child,Data : Pointer);
var
fWindoew : pgdkWindow;
gc: pgdkGC;
R : TRect;
begin
fWindow := pgtkEidget(Child)^.Window;
gc := gdk_gc_new(pgdkWindow(fWindow));
gdk_draw_rectangle(fWindow,gc,1,TRect(data^).Left,TRect(data^).Top,TRect(data^).Right,TRect(data^).Bottom);
gtk_widget_draw(child,data);
end;Any thoughts?
Shane
Shane Miller wroteOK, I changed my fillrect procedure to do the following, but it still doesn't show up!....
Shane I don't know if this is related or not. I haven't had a chance to look at your TCanvas code so if not just ignore me.
When I created the hello_world application I noticed something strange. I place the button on the from and just let it us the default sizes that are set when the button is created.
The button didn't show. It would be drawn on the form.
The only way I could get the button to draw on the form was to CHANGE the top,left,width,height after the button was created. Then an only then would the button be drawn. This needs to be looked at anyway but maybe it is related to your problem of things not showing up.
How did you get ahold of the stock? It's still in IPO stage. You have an account with the underwriter?
Shane
>> "Michael A. Hess" 07/21 9:54 AM >>>
Cliff" wroteNot anymore I fixed that problem.
See, I thought I might not know what I was talking about. :-) Good glad you fixed this.
I am going to post a message to the gtk devloper list.
Is it actually a gtk problem?
BTW I also placed a grand into RedHat Software for stock prior to going public in a few days. I now have a vested interest "my money" in linux development.
Wow. You mean you actually have a grand lying around to invest in something? Lucky you. ;-)
Actually, that function doesn't exist. There is a gdk_window_set_background and a gdk_gc_set_foreground.
I've tried both. When I get the GC from a window and change it, do I have to set the gc back to the window? See,when I change the foreground or background, it does nothing......
Shane
>> "Baeseman, Cliff" 07/21 2:43 PM >>>
gdk_set_foreground(window,gc,color)
something to that effect. the definition id in gdkmain.pp
Cliff
I have been sticking with the examples under GTK, and have found some problems with…
Maybe it has to do with the packing of records which is still not 100% the same as under C as michael wrote in a message to the core developpers
Peter
I have been sticking with the examples under GTK, and have found some problems with…
This is was KCL is currently doing to work around this compiler bug:
procedure TPaintBox_Expose(GtkWidget: PGtkWidget; event:
PGdkEventExpose;
PaintBox: TPaintBox); cdecl;
type
TWordRect = packed record
x, y, w, h: Word;
end;
var
rect: TRect;
wrect: TWordRect;
Canvas: TCanvas;
begin
if (GtkWidget nil) and Assigned(PaintBox.Draw) and
(PaintBox.FCreationState = wcsCreationDone) and
(PaintBox.BlockDrawingCounter = 0) then begin
{*** The following should work, but it doesn't (y and height get
wrong)
- bug in GTK unit? /sg
rect.Left := event^.area.x;
rect.Top := event^.area.y;
rect.Right := rect.Left + event^.area.width;
rect.Bottom := rect.Top + event^.area.height;}
Move(PByteArray(event)^[10], wrect, 8);
rect.Left := wrect.x;
rect.Top := wrect.y;
rect.Right := rect.Left + wrect.w;
rect.Bottom := rect.Top + wrect.h;
Canvas := TGdkExposeCanvas.Create(PaintBox);
// WriteLn('Clipping to ', rect.Left, '/', rect.Top, ' - ',
rect.Right, '/', rect.Bottom);
gdk_gc_set_clip_rectangle(Canvas.priv.gc,
PGdkRectangle(@PByteArray(event)^[10]));
PaintBox.Draw(PaintBox, Canvas, rect);
Canvas.Free;
end;
end;- Sebastian
I hope they sell at a dollar and sky rocket to 100 and them I am going to jump off..
Cliff
I need to see the code that you actually got to work. I think somehow we have to blast the gc back to the window...
Cliff
Actually, that function doesn't exist. There is a gdk_window_set_background and a…
Shane Miller wroteActually, that function doesn't exist. There is a gdk_window_set_background and a gdk_gc_set_foreground.
On page 257 of "Developing Linux Applications with GTK+ and GDK" it says," Every widget in GTK+ as a style that determines how it is to be drawn on the screen."
Anyway go to this link. It is all the example from the above book. Take a look at Chapter 12. It deals with drawing and using rectangles and colors.
http://www.bcpl.lib.md.us/~eharlow/book/
Nothing like a little test of the skills... :)
NOw that is some good news...
Cliff
Michael, thanks for the link.
Actually, I have that book and have read it. Here's the thing. The style tells the widget how it should be drawn, not how it should be drawn TO. See, if I want to draw a red rectangle to the window and I set the style to all reds, then the entire widget is red. I'll see if I can switch the style back or something and see if that works.....
Shane
>> "Michael A. Hess" 07/21 3:37 PM >>>
Shane Miller wroteActually, that function doesn't exist. There is a gdk_window_set_background and a gdk_gc_set_foreground.
On page 257 of "Developing Linux Applications with GTK+ and GDK" it says," Every widget in GTK+ as a style that determines how it is to be drawn on the screen."
Anyway go to this link. It is all the example from the above book. Take a look at Chapter 12. It deals with drawing and using rectangles and colors.
http://www.bcpl.lib.md.us/~eharlow/book/
Thanks for the info Michael.
After a long and difficult trial with this color thing, I believe I have it working. I can draw multiple colored rectangles at the same time now on the form. It works quite well.
I will update CVS shortly..
Shane
Michael, thanks for the link. Actually, I have that book and have read it. Here's the…
Correct. I was writing that quote to point out the difference.
See, if I want to draw a red rectangle to the window and I set the style to all reds, then the entire widget is red. I'll see if I can switch the style back or something and see if that works.....
This is why I indicated Chapter 12. The example is drawing the molecular stuff onto the screen and it is using rectangles and what not and using different colors for each. I though that might point something out to you as to how they are setting the colors to draw that item.
CVS is updated. Stretch the main for to see the "editor". You can't do anything yet.
The FIle OPen doesn't color correctly either because I changed the TCOlor definition but the main thing is the canvas works.
The only thing you can draw currently is a fillled rectangle. Procedure Form1Paint in MAin.pp has examples of the code.
Shane
>> "Shane Miller" 07/22 10:47 AM >>>
Thanks for the info Michael.
After a long and difficult trial with this color thing, I believe I have it working. I can draw multiple colored rectangles at the same time now on the form. It works quite well.
I will update CVS shortly..
Shane
_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus
Re: Makefiles, It was a procedure thing. I thought '.' would get it. I did not take the time to figure it out. I works now that I used SAMPLECFG via your previous instructions.
Re: Scribble. Just remade it all. I added writelines to scribble. First Height s/b=200 is =0, state ??? s/b=0 is =16. ...So nothing is visibly changed here???????
Is it just me?
Tom
1. I updated lazarus from CVS on Win32, I compiled and ran. I opened a file, stretched the window...there was colorized text there, but the resize was temporarily working then the biggest part of the window was overwritten.
2. Since I could not rebuild the compiler on win32 yet, I went to LInux.
I pulled the latest from CVS....Including the base, rtl, compiler, gtk, and fcl (in order to test for the C alignment).
I compiled/installed it all. I had a problem compiling/makeing lazarus. I deleted my /etc/ppc386.cfg.
I went to /usr/lib/fpc/0.99.13 and did a `samplecfg '.'` I made one for me. Still had problems. I kept adding things to the ppc386 call till I ended up with this:
ppc386 -Tlinux -Fu../rtl/linux -Fu../units/linux -Fu../fcl/linux -Fu../rtl/linux -Fu../gtk
-Fl/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66 -Fl/usr/local/glib-1.2.3 -Fl/usr/X11R6/lib -Fl/usr/lib -Fl/usr/i486-linux-libc5/lib -Fu../gtk/glib -Fu../gtk/gdk -Fu../gtk/gtk -Fi../fcl/inc -Fi../fcl/linux -FE. -di386 lazarus.pp
So I ran Lazarus, opened a File, stretched the window, and...NOTHING!
Shane,
When is the last time you updated your compiler?
Tom
Has anyone tried Lazarus since I made the canvas changes? Have they workewd with the new compiler? I thought Payne said there was a problem with the new cvs update for FPC when you try to run Lazarus.
I just updated and rebuilt everything (compiler, gtk, rtl, etc) and then rebuilt Lazarus with all the latest updates from CVS. It works great. The new TCanvas looks great. Great job.
Curtis
I just updated from CVS to another machine to see if the TCanvas works and it does. I haven't updated the compiler though today. Probably a few days old.....
Shane
Yes you are absolutely correct. I headed down that path and it works...but I am having trouble with scribble... I rebuilt gtk but not the compiler since this afternoon. I will try again and post.
Tom
If I sound giddy, that's because I AM!
OK, I've updated CVS again.
The TCanvas is NOT perfect yet, but somewhat impressive (at least I think so) TCanvas now has the following done (working):
FillRect
Rectangle
Line
LineTo
TextOut
Pull the latest from CVS, and compile/run it. Go to FILE OPEN. Now, you don't actually open a file YET, but soon. Click on a file and stretch the new form out.
COOL HUH?
I like......
Thoughts?
Shane
Re: Makefiles, It was a procedure thing. I thought '.' would get it. I did not take the…
????
Peter
1. I updated lazarus from CVS on Win32, I compiled and ran. I opened a file, stretched…
You should run 'samplecfg /usr/lib/fpc/0.99.13' and then for all the units you're making (FCL,gtk,rtl)
goto gtk sources:
make install
goto fcl sources:
make install
that will automaticly copy all the units to the correct units dirs which are also set in ppc386.cfg
Why do you all make it so difficult to not use the makefiles :(
Peter
1. I updated lazarus from CVS on Win32, I compiled and ran. I opened a file, stretched…
Why do you have ../gtk/glib, ../gtk/gdk etc. with -Fu ? Just run 'make' in ../gtk and it should place all units there.
Peter
Not I did I merge some old code or something? Cliff -----Original Message----- From:…
Cliff wroteNot I did I merge some old code or something?
I didn't change anything either. Since I think only you, Cliff and I are the only ones making commits at the moment it must have been just a mistake.
No, but it must be new code because it doesn't compile. It returns a TControlCanvas and it expects a TCanvas so it must be new.
I changed it and updated CVS.
Shane
------------------------------------------------------------ Shane Miller
Home page : http://www.lakefield.net/~smiller
Auto-IP Publisher : http://www.lakefield.net/~smiller/autoip
Advanced Clipboard : http://www.lakefield.net/~smiller/advclipboard
Lazarus : http://www.pcpros.net/~vbman
----------------------------------------------------------
Who changed TForm by adding the GetCanvas procedure to it? And why?
Shane
Not I did I merge some old code or something?
Cliff
I think I might have done it like last week some time.
Cliff