Updating Image Problem

Linux specific forum
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Updating Image Problem

Post 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
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: Updating Image Problem

Post 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.
oh... and have a nice day.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Updating Image Problem

Post 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. :)
Post Reply