Some problem with FPC and Gtk 
Author Message
 Some problem with FPC and Gtk

Hi guys,

I'm very glad to have found Free Pascal Compiler for Linux and its
support for the Gtk-widget library, because I think Pascal is still one
of the most _elegant_ programming languages around (the concept with
procedures within a procedure is genius!).
Now I've got some questions concering FPC and Gtk.
When I like to enable a text field for editing, I just use the C-code line:

gtk_text_set_editable (GTK_TEXT (gtk_text), true);

but the compiler always gives the following error message:

Fatal: Syntax Error, ) expected but ( found

Does anyone know what's wrong here?

Secondly, I usually create the gui stuff with Glade, export it to C-code
and then transfer this code to pascal,which is quite easy.
But I don't know how to transfer the following c-code line:

gtk_object_set_data_full (GTK_OBJECT (window),
'statusbar',statusbar,(GtkDestroyNotify) gtk_widget_unref);

I get the following error message when trying to compile it:

Error: Identifier not found GTKDESTROYNOTIFY
Fatal: Syntax Error, ) expected but identifier GTK_WIDGET_UNREF found

So I just deleted the line and obviously it didn't matter. Is this line
important (well, at least it must be in C...) or can I leave it out?
If not, what looks this line like in Free Pascal?

Thanks in advance,

Dennis Schramm
www.dennis-schramm.com

BTW, do you know websites with some more examples about Free Pascal and Gtk?



Wed, 23 Nov 2005 02:14:12 GMT  
 Some problem with FPC and Gtk

Quote:

> I'm very glad to have found Free Pascal Compiler for Linux and its
> support for the Gtk-widget library, because I think Pascal is still one
> of the most _elegant_ programming languages around (the concept with
> procedures within a procedure is genius!).
> Now I've got some questions concering FPC and Gtk.
> When I like to enable a text field for editing, I just use the C-code line:

> gtk_text_set_editable (GTK_TEXT (gtk_text), true);

> but the compiler always gives the following error message:

> Fatal: Syntax Error, ) expected but ( found

> Does anyone know what's wrong here?

> Secondly, I usually create the gui stuff with Glade, export it to C-code
> and then transfer this code to pascal,which is quite easy.
> But I don't know how to transfer the following c-code line:

> gtk_object_set_data_full (GTK_OBJECT (window),
> 'statusbar',statusbar,(GtkDestroyNotify) gtk_widget_unref);

> I get the following error message when trying to compile it:

> Error: Identifier not found GTKDESTROYNOTIFY
> Fatal: Syntax Error, ) expected but identifier GTK_WIDGET_UNREF found

You didn't translate the typecast.

C typecasts look like this:
  (type) valuetotypecast

Pascal typecasts look like this:
  type(valuetotypecast)

So both are the same syntax, and should read something like
...,gtkdestroynotify(gtk_widget_unref), ....    and likewise for the other one.



Wed, 23 Nov 2005 03:28:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with FPC and GTK

2. FPC:problem with printing from fpc programs

3. FPC: translate execvp from c to FPC

4. GTK-Question: gtk_window_set_transient_for not supported?

5. Action-Signal with Gtk

6. GTK or QT OOP wrapper

7. GTK & FPK

8. FPC - Socket Problem

9. FPC problems!

10. FPC: no more linking problems

11. problems with Free Pascal Editor IDE for FPC

12. Problem with interfaces (FPC)

 

 
Powered by phpBB® Forum Software