On 2 Dec 2012, at 08:07, Jason Liu wrote:

> Basically I'm having an issue with a global variable. I have int songCounter 
> declared outside of main in source file only, a double window, and a few 
> buttons inside the window to manipulate cycling through the playlist. 
> songCounter is initialized to 0 at the start of the program. I have a 
> forwards and backwards buttons in my window, which increment and decrement 
> songCounter. Using the output boxes built into FLTK show that songCounter is 
> being incremented/decremented successfully, but the first song plays over and 
> over again. My guess is that instead of incrementing or decrementing 
> songCounter directly, they're somehow creating local versions of the variable 
> to work with instead. Any ideas on how to work around this?


What you are describing sounds like it should Just Work, so in the absence of 
seeing more of your code, I'd speculate that the callback functions are not 
using the global songCounter var at all, but instead you have (presumably 
accidentally) shadowed the global with a local redeclaration.

If you can post some of your code so we can take a look, that might help clear 
things up.

Ideally, if you can post a small but complete and compileable example here, 
that exhibits the fault, then we can can try it...




_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to