Page 1 of 1
File.sb example
Posted: Tue Mar 18, 2025 8:30 am
by akee
I got this error:
error: Uncaught ReferenceError: PB_Requester_MultiSelection is not defined...
Also, The "Copy Log" feature does not work. Have to type from what I see.
// Moved from "Bugs Reports" to "Coding Questions" (Peter)
Re: File.sb example
Posted: Tue Mar 18, 2025 9:26 am
by Peter
error: Uncaught ReferenceError: PB_Requester_MultiSelection is not defined...
I cannot confirm this. It works as expected (SpiderBasic V3.02)
Requester.sb:
Code: Select all
; ------------------------------------------------------------
;
; SpiderBasic - Requester example file
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;
Procedure RequesterSuccess()
; Process all the selected filename
;
While NextSelectedFile()
Debug SelectedFileName()
Wend
EndProcedure
Procedure ButtonEvent()
OpenFileRequester("", @RequesterSuccess(), #PB_Requester_MultiSelection)
EndProcedure
If OpenWindow(0, 100, 100, 200, 45, "File")
ButtonGadget(0, 10, 10, 180, 25, "Open local file(s)...")
BindGadgetEvent(0, @ButtonEvent())
EndIf
P.S.: There is no #PB_Requester_MultiSelection in File.sb.
Also, The "Copy Log" feature does not work. Have to type from what I see.
I cannot confirm this either.
Re: File.sb example
Posted: Tue Mar 18, 2025 10:16 am
by Mindphazer
I guess he's talking about this example (file.sb)
Code: Select all
;
; ------------------------------------------------------------
;
; SpiderBasic - File example file
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;
Procedure ReadCallback(Status, Filename$, File, Size)
If Status = #PB_Status_Loaded
Debug "File: " + Filename$ + " - Size: " + Size + " bytes"
Debug "Reading first 3 lines:"
; Read the first 3 lines
;
While Eof(0) = 0 And NbLine < 3
Debug ReadString(0)
NbLine+1
Wend
CloseFile(0)
ElseIf Status = #PB_Status_Error
Debug "Error when loading the file: " + Filename$
EndIf
EndProcedure
Procedure OpenFileRequesterCallback()
If NextSelectedFile()
ReadFile(0, SelectedFileID(), @ReadCallback(), #PB_LocalFile)
EndIf
EndProcedure
Procedure ChooseFileEvent()
OpenFileRequester("text/plain", @OpenFileRequesterCallback())
EndProcedure
OpenWindow(0, 0, 0, 300, 50, "Read file example", #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 280, 30, "Choose a text file...")
BindGadgetEvent(0, @ChooseFileEvent())
But it works as expected, and there is no #PB_Requester_MultiSelection either...
Re: File.sb example
Posted: Tue Mar 18, 2025 10:48 am
by akee
I am using 3.02. I am trying to see how to handle local files. I can create it but when I read it it always reads the cached values. I cannot find where to clear the cache.
Re: File.sb example
Posted: Tue Mar 18, 2025 11:03 am
by akee
here's a screen shot of what i mean... and if you right click where the white arrow is and select Copy Log, nothing is copied.
https://www.sendspace.com/file/155mz2