We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variables in Subroutines
#1
LitDev,

Using SB-Prime I wanted to capture variable changes while in the subroutine. These only show after the program goes back to the main loop. Is there any way to get it to do what I want it to do? I know the variables change while in the subroutine, but they don't show it.

JR
Reply
#2
Hi,

Can you please please provide a small code segment you are having trouble with.

The example below works for me, breaking inside the subroutine when the variable 'data' changes.

   
[-] The following 1 user Likes litdev's post:
  • z-s
Reply
#3
LitDev,
I am still trying to simplify the code to show what I am seeing.This isn't exactly it, but it runs in regular mode, but doesn't even start in debug. Why? The little o by txtSelect is a breakpoint.

JR

LoadDB()
TextWindow.WriteLine(ext)
while "True"
Program.Delay(20)
EndWhile

Sub LoadDB 'Load existing database

ext = "db" 'Filename extension for databases
o txtSelect = "Please open an existing database"
select = "open"

EndSub 'OpenDatabase
Reply
#4
When I test your program in debug mode
- the fi"rst time by pressing the "step" button a number of times, it works (print "db") en starts to cycle the while loop
- starting by pressing the "start/resume" button : stops at the breakpoint, and again pressing that button prints "db
[-] The following 1 user Likes WhTurner's post:
  • litdev
Reply
#5
Similar to WHTurner I think, I can't reproduce unexpected (to me) behavior.

Will need more detailed instructions how to reproduce - perhaps there is misconception about how it is supposed to work?
[-] The following 1 user Likes litdev's post:
  • z-s
Reply
#6
LitDev,

Yea, mine works now too. Sometimes things don't work then they do. I'll work on it later. Thanks

JR
Reply
#7
LitDev,

I don't see any other way to do this, but I exported the problem program with small basic. To import use HBWL61.000. It's just a database program. After loading put a breakpoint at subroutine buildtable. then start the program and select file, new database. Put in a name for the database you are creating. That should take you to the build table subroutine which stops you at the breakpoint. If you step through you'll see the variables don't get updated until it gets back to the main routine wait loop.

I don't see any way with this BB software to upload files. I couldn't even send a picture. How did you do it?

JR
Reply
#8
HBWL61.000 cannot be imported  Sad
Reply
#9
I agree uploading things is tricky with MyBB, also my hosting doesn't have infinite space so maybe thats not so bad.

Anyway to upload an image first save it to a file, then you can use the Attachements window below the main editing window to drop stuff, then insert it.  Currently only images that are not too big.
[-] The following 1 user Likes litdev's post:
  • z-s
Reply
#10
LitDev,

This one works for me LQFH125.000. I hope it works for you! No idea what happened with the other although I didn't try it.

JR
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)