[5.30 (x86)] - ReceiveHTTPFile locks interface [RESOLVED]
Posted: Mon Aug 04, 2014 11:51 pm
				
				System:
Best regards,
~Garrett
			Library/Command/Function involved:PureBasic 5.30 (Linux - x86)
Distro: elementary OS: 0.2.1 "Luna"(32-bit)
Based on: Ubuntu 12.04("Precise")
Intel Core 2 CPU 6300 @ 1.86ghz x 2
Memory: 2gb
Symptom:Library: HTTP/Gadget
Command: ReceiveHTTPFile()
Example Code:When downloading webpages using ReceiveHTTPFile, the interface is locked and you cannot update any gadgets before/between and after the file(s) are downloading(ed). For example, downloading several pages, in between the ReceiveHTTPFile for each file, I was trying to update the statusbar text with the current page to download, but the update of the statusbar is blocked/locked. This goes for other gadgets besides the statusbar. You also cannot disable or enable any other gadgets before, during or after the ReceiveHTTPFile call.
Code: Select all
  OpenWindow(0,60,60,450,60,"Webpage Download Example",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
  ButtonGadget(0,0,0,100,30,"Download")
  ButtonGadget(1,100,0,100,30,"Exit")
  CreateStatusBar(0,WindowID(0))
    AddStatusBarField(#PB_Ignore)
    StatusBarText(0,0,"Ready...")
EVENTLOOP:
  vWindowEvent = WaitWindowEvent()
  If vWindowEvent = #PB_Event_CloseWindow
    Goto CLOSE
  EndIf
  If vWindowEvent = #PB_Event_Gadget
    If EventGadget() = 0
      Goto DOWNLOAD_PAGES
    ElseIf EventGadget() = 1
      Goto CLOSE
    EndIf
  EndIf
  Goto EVENTLOOP
DOWNLOAD_PAGES:
  DisableGadget(0,1)
  DisableGadget(1,1)
  vWebPage.s = "http://www.freewarehome.com/index.php?"
  vPagesTotal = 30
  vCurrPage = 1
  InitNetwork()
  Repeat
    If ReceiveHTTPFile(vWebPage.s,"testwebpagedownload.txt")
      vBreakOut = 0
    Else
      MessageRequester("Download Error", "Was not able to download the requested webpage.  Either you are not connected or the server is down.")
      vBreakOut = 1
    EndIf
    DeleteFile("testwebpagedownload.txt")
    StatusBarText(0,0,"Downloading page " + Str(vCurrPage) + " of " + Str(vPagesTotal))
    vCurrPage = vCurrPage + 1
    vWebPage.s = "http://freewarehome.com/index.php?/page/" + Str(vCurrPage)
  Until vBreakOut = 1 Or vCurrPage > vPagesTotal
  DisableGadget(0,0)
  DisableGadget(1,0)
  Goto EVENTLOOP
CLOSE:
; -- End of the line my friend.~Garrett