LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-29-2008, 02:43 PM   #1
Four
Member
 
Registered: Aug 2005
Posts: 298

Rep: Reputation: 30
Gtk+-2.0 Calling constructor [language C]


Hi,

I'm making a widget and deriving it from a GtkVBox. How do I call the constructor of the GtkVBox? Looking at the tutorial on tictactoe widget. The widget is derived from the GtkTable, however there is no gtk_table_new()?

Thank you
 
Old 05-29-2008, 04:12 PM   #2
LordAnta
Member
 
Registered: Apr 2008
Location: Munich, Germany
Distribution: Slackware current
Posts: 128

Rep: Reputation: 18
Let's have this exampple:

Code:
class A
{
 A();
}

class B: public A
{
 B();
}
When you have
Code:
  B b;
it calls the constructor of B (B()) and the constructor of A (A()). So in your case, the constructor for the GtkVBox will be called automatically, after the call your widgets constructor.
 
Old 05-30-2008, 11:02 AM   #3
Four
Member
 
Registered: Aug 2005
Posts: 298

Original Poster
Rep: Reputation: 30
Thank you LordAnta,

Unfortunately I'm dealing with only C without the C++ extensions working with GTK+-2.0 API. I made a widget using GtkTable like in the example, but I think (for my purposes) it would be better to use a GtkVBox.I don't understand how the GtkVBox will be initialized and how to change some of its parameters.
 
Old 05-30-2008, 02:21 PM   #4
LordAnta
Member
 
Registered: Apr 2008
Location: Munich, Germany
Distribution: Slackware current
Posts: 128

Rep: Reputation: 18
sorry, totally forgot that GTK is only in C. Too much Qt and OOP for me the in the last few days

L.E.: found this example on google: http://www.linuxheadquarters.com/how...box/vbox.shtml

Code:
  GtkWidget *vbox;
  vbox = gtk_vbox_new(FALSE,0);
Hope it helps.

Last edited by LordAnta; 05-30-2008 at 02:27 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
not calling copy constructor on function return jhorvath Programming 7 09-22-2009 12:43 PM
calling a superclass constructor kpachopoulos Programming 1 09-04-2006 12:15 PM
Calling GTK file from QT sudheervegi Linux - General 2 07-05-2006 11:21 AM
Calling GTK file from QT sudheervegi Linux - General 2 07-05-2006 10:32 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration