Progress_bar failing to change

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

 



Hi All, I'm having a strange problem using

gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(Battery), x);

I have it in two places, the first in my file that has main() and that works like I'd expect. The second in a different module and that compiles and runs but fails to change the progress bar. Stepping using cgdb I can step through the Gtk code but I'm lost with that. I've included a simplified code modules to give some idea of what I'm doing. Is this because I'm using g++ rather than gcc?

/* First Module */
Main.cpp
#include <gtk/gtk.h>
GtkWidget *Battery;

extern "C"
void on_StartScan_activate() //Signal to update the battery
{ printf("Start Scan Activated. \n");
scan_fg =1;
controller(); //In module comms.cpp
return; }

extern "C"
void on_Refresh_activate() { //Signal to test the progress bar.
gdouble x;
x = (float)0xe000 / (float)0xffff;
printf("Refresh clicked. \n");
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(Battery), x); //This works
return; }

main (int argc, char *argv[])
{
// The code to pull pointers from main.glade into builder, window and Battery.
}

/* Second Module */
comms.cpp

#include <gtk/gtk.h>
extern GtkWidget *Battery;

void controller(void)
{
int n, unpack_fg, w;
gdouble w;
/* The following seems to be ignored */
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(Battery), w); //BAR IS UNCHANGED!
}

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux