Page 1 of 1

Updating Image Problem

Posted: Tue Mar 23, 2010 11:24 pm
by Foz
I have a small (200 x 200) image that is being created & updated, but setting the image to the ImageGadget to update the image isn't working.

I'm using Ubuntu 9.10 x64. Any ideas?

Code: Select all

Procedure DrawIt(width, height)
  If Not IsImage(0)
    CreateImage(0, Width, Height, 32)
  EndIf
  StartDrawing(ImageOutput(0))

  DrawText(0, 0, StrD(minValue))
  DrawText(0, 20, StrD(maxValue))
  DrawText(0, 44, Str(ElapsedMilliseconds()))

  StopDrawing()
EndProcedure

#width = 200
#height = 200

DrawIt(#width, #height)

OpenWindow(0, 100, 100, #width, #height, "twizzle")
ImageGadget(0, 0, 0, #width, #height, ImageID(image))

Repeat
  DrawIt(#width, #height)
  SetGadgetState(0, ImageID(0))
  
Until WaitWindowEvent(100) = #PB_Event_CloseWindow

Re: Updating Image Problem

Posted: Tue Mar 23, 2010 11:40 pm
by Kaeru Gaman
try that:

Code: Select all

Repeat
  Event = WaitWindowEvent(100)
  If Event = 0
    DrawIt(#width, #height)
    SetGadgetState(0, ImageID(0))
  EndIf
Until Event = #PB_Event_CloseWindow
Actions that create events must only be processed conditional, not every iteration, or the queue will overflow.

that's what I do on windows, and I guess this is not an Ubuntu specific problem.

Re: Updating Image Problem

Posted: Wed Mar 24, 2010 12:07 am
by Foz
D'oh! It's always the simple little things that trip me up...

The reason I posted it in the Linux section was that the code works in Windows but didn't on Ubuntu, but as you rightly point out the queue will have been overflowing causing idiot programmer issues. :)