Question

i have a piece of code in function called check_pwd that do:

if(g_strcmp0(s1,s2) != 0){
   gtk_label_set_text(GTK_LABEL(a), "error");
   return -1;
}
else{
   gtk_label_set_text(GTK_LABEL(a), "ok");
   //other things
}

While the "error" message is displayed because the program return the control to the main function, how can i show the "ok" message?

Was it helpful?

Solution

Sure, just run the main loop:

while(gtk_events_pending())
  gtk_main_iteration();

See the GTK+ documentation, which recommends the above with:

Checks if any events are pending.

This can be used to update the UI and invoke timeouts etc. while doing some time intensive computation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top