Updating a Stringgadget while reading from SQLITE database

Just starting out? Need help? Post your questions and find answers here.
Marvi
User
User
Posts: 17
Joined: Fri Oct 03, 2008 6:02 pm
Location: Milano

Updating a Stringgadget while reading from SQLITE database

Post 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?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Marvi
User
User
Posts: 17
Joined: Fri Oct 03, 2008 6:02 pm
Location: Milano

Post by Marvi »

Ah ok, now it works, many thanks.

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