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
filterString
windowInt
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.
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. bgiGetEventData is 1 if a file was imported, or 0 if the user cancelled or the file was too big for the web file store. bgiGetEventExtra is the stored file name. Call it from a button or menu handler: browsers only open a file picker just after the user clicks or presses a key. Web target only.
Example
Example.bam
; In WebLoop: the Import button asks for a file...If eventSource = btnImport Then bgiImportFileWeb(".rtf,.txt", window)
; ...and the answer loads itIf bgiGetEventMessage() = BGI_EVENT_COMMAND_CLICK And bgiGetEventID() = BGI_EVENT_ID_IMPORTFILE ThenIf bgiGetEventData() = 1Then bgiLoadRichTextFile(richTextBox, bgiGetEventExtra())
EndIf