Re: data acqusition, display and control



On 10/17/05, Tristan Van Berkom <tvb gnome org> wrote:

Premsagar C wrote:
I am using gtk to develop a control interface. Am a bit new to this.
BAsically I am acquiring data using some library functions and
dispalying them in 6 text boxes . When i click on the bacq function
this acquistion starts.



gtk_signal_connect(GTK_OBJECT(bacq),"clicked",GTK_SIGNAL_FUNC(button_funcacq),NULL);


My problem is that when this happend the dispaly window goes blank and
am unable to control it. I need to be able to access another button
when this acqusition is occuring and it id part of the same window.
How do I do that ? Is there some other signal event I can use.

If I'm reading you right; your button_funcacq() function is doing a
lengthly calculation or some lengthly data acquisition operations and
while this function is running; your UI is unresponsive... dont panic,
this is normal :)

What you need to do is one of the following:
o Split your data acquisition operation into small itterations
(example: limit your sql queries to 100 rows per result set)
and run these itterations in an idle or timeout handler.

o If you are stuck with some proprietary API that allows
you only to call one funtion for an entire operation
thats going to take a half an hour to execute, you'll
have to use a "worker thread" to aquire the data silently
in the background and notify the primary thread after
the lengthly offending culprit function finally returns
(probably using an idle handler for notification, or these
days you can probably use a GChildWatchSource).

I recommend you read the juicy parts of this page:
http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html

Cheers,


 -Tristan


  Tristian,
A timeouthandler did the job howvever I still have a few bugs. My data
acuqisition is working and getstting displayed on my text widget as I have
included my timeout in the main . On clicking a button i require to stop the
data acqusition and do a few other operations(they all work). however on
removing the timeout I am not able to use the main menu button anymore. The
system crashes saying there is a segmentation error



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