File.sb example

Just starting out? Need help? Post your questions and find answers here.
akee
Posts: 20
Joined: Fri Jun 27, 2014 7:20 pm

File.sb example

Post 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)
User avatar
Peter
Posts: 1197
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: File.sb example

Post 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.
Mindphazer
Posts: 4
Joined: Mon Mar 17, 2025 9:20 am

Re: File.sb example

Post 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...
akee
Posts: 20
Joined: Fri Jun 27, 2014 7:20 pm

Re: File.sb example

Post 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.
akee
Posts: 20
Joined: Fri Jun 27, 2014 7:20 pm

Re: File.sb example

Post 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
Post Reply