interface not responding in glade 3 / gtk with C
Hi,
I am a fairly new ubuntu user. I am using ubuntu 10.04 and glade 3 for building a simple interface that uses C . In my interface , I have created two buttons : start and stop .Tofocus on my actual problem , I have created a simpler UI and code . start button runs a while(1) loop and stop should stop the loop . The problem is , when I press start , the gui freezes and I cannot press any other button . I cant even close my app.After some thorough experimentation, I found out that when I press start , it never comes out of the while loop . I need the loop to keep running until I press stop . What should i do ? Here are the functions for the clickable buttons : Code:
|
^ i dont know about the freezing issue (try putting in something like sleep(1); after the pprintf()) but the flag1 variable is not global.
what that means is that on_start_button_clicked's flag1 is not the same as on_stop_button_clicked's flag1. |
Quote:
The flag1 variable is in fact global . When i click stop before I click start , the loop runs once and exits (that would only happen if the value of flag1 changed to 1 before i pressed start). I also tried putting sleep() , but the loop would only free up my gui on its exit condition being satisfied. If I replace the while(1) with : Code:
the app would still run through the whole while loop ... I cannot press any other button till then . |
Quote:
maybe stepping thru the program in gdb mite help ? edit: i dont think it is good programming behaviour to use breaks; maybe something like this would be better: Code:
void on_start_button_clicked (GtkButton *button, gpointer user_data) |
All times are GMT -5. The time now is 02:26 AM. |