bgiImportFileWeb

Lets the user pick a file on their computer and copies it into the web file store. Takes filter (the file types to offer, e.g. ".rtf,.txt" ("" for any file)), window (the window that gets the answer).

BGI GUI

Parameters & Returns

Parameters

filter String
window Int

Returns

Int

Quick Summary

Lets the user pick a file on their computer and copies it into the web file store. Takes filter (the file types to offer, e.g. ".rtf,.txt" ("" for any file)), window (the window that gets the answer).

Technical Exegesis...

Lets the user pick a file on their computer and copies it into the web file store. The browser's own file picker opens. The chosen file is stored under its own name, so bgiLoadRichTextFile, fileReadFile and so on can then read it. A browser can't wait for the user, so the function returns at once: 1 if the picker opened, 0 if the window doesn't exist. The answer arrives later as an event: Message BGI_EVENT_COMMAND_CLICK, ID BGI_EVENT_ID_IMPORTFILE, source = window.

Example

Example.bam
; In WebLoop: the Import button asks for a file...
If eventSource = btnImport Then bgiImportFileWeb(".rtf,.txt", window)

; ...and the answer loads it
If bgiGetEventMessage() = BGI_EVENT_COMMAND_CLICK And bgiGetEventID() = BGI_EVENT_ID_IMPORTFILE Then
    If bgiGetEventData() = 1 Then bgiLoadRichTextFile(richTextBox, bgiGetEventExtra())
EndIf