Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 12-22-2005, 11:43 PM   #1
LQ Newbie
Registered: Oct 2005
Posts: 5

Rep: Reputation: 0
Can sub processing modify the parent's Gtk Widgets?

Hi,everyone,I am new bie to Gtk programming,There is now a question puzzling me,I use fork syscall to create a sub process,and I want to modify the widgets in its father,for example,I want to modify the content of the label,However,when I coded it,I found perhaps In the sub process,I cannot modify the parent's widgets?

Is there some way to implement this?or it is definitely impossible to modify the parent's widgets in sub process.

I am a chineses boy,sorry for my poor english,thank you!
Old 12-23-2005, 11:22 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
In general, file descriptors opened in one process are inherited by child processes ...
... but the MEMORY space in one process is separate and distinct from the memory space of any other process - even child processes.

So no, a GTK+ widget in a parent process cannot be directly manipulated by any of its children.

Two possible solutions:

1. Set up a communications channel between the parent and child.

The GTK+ "selections" mechanism might be a good way to do this:

Alternatively, you could use any standard Unix IPC, from pipes through to message queues:

2. Use threads in a single process (instead of forking off child processes)
Old 12-24-2005, 03:35 AM   #3
LQ Newbie
Registered: Oct 2005
Posts: 5

Original Poster
Rep: Reputation: 0
thank you greatly,today i tried the signal and kill function,child processes send signal to the parent process,and the parent process modify the gtk widgets itself,it works.
I am not very familiar with IPC,but I have learned it before,I think its a good way to solve the question.
Thank you again!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
make firefox use gtk for web widgets? SciYro Linux - Software 5 05-05-2005 04:19 PM
How to modify the library path variable?modify the Electronkz Linux - Newbie 1 04-13-2004 06:18 AM
GTK widgets don't show text phaidros Linux - Software 0 12-16-2003 06:45 AM
GTK problem: no text in widgets phaidros Linux - Newbie 0 12-16-2003 02:16 AM
modify file access & modify timestamps i2itstud Linux - General 1 05-20-2003 03:34 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:26 PM.

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