Page 1 of 1

Updating a Stringgadget while reading from SQLITE database

Posted: Thu Oct 16, 2008 9:52 am
by Marvi
While reading from a Sqlite database (500000 records)
my program updates 3 StringGadget, containing the
number of the record and other stuff.

Nothing appears in StringGadget but the last value.
Also if I modify my program in order to show me 1 value every 100 record readings.

The only effort program seems to be able to make
is managing database: only at the end it updates
my StringGadget (only last value, of course)

Can someone hint me anything?

Posted: Thu Oct 16, 2008 10:55 am
by gnozal
If you want your stringgadget to be updated, you have to handle the events. Note that it will slow down your loop.

Quick example :

Code: Select all

If OpenWindow(0, 450, 200, 400, 125, "Example", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
  StringGadget(0, 32, 31, 344, 27, "0")
EndIf
;
For I = 0 To 10000
  SetGadgetText(0, Str(I))
  ; Try with and without this line
  While WindowEvent() : Wend  
  ;
Next
;
Repeat
  If WaitWindowEvent() = #PB_Event_CloseWindow
    Break
  EndIf
ForEver

Posted: Thu Oct 16, 2008 11:22 am
by Marvi
Ah ok, now it works, many thanks.

Progress bar gadget was working without managing any event, I thought StringGadget too.