Variables in Subroutines - Printable Version +- Small Basic Forum (https://litdev.uk/mybb) +-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1) +--- Forum: Discussion (https://litdev.uk/mybb/forumdisplay.php?fid=4) +--- Thread: Variables in Subroutines (/showthread.php?tid=24) |
Variables in Subroutines - jrmrhrb00 - 12-08-2023 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 RE: Variables in Subroutines - litdev - 12-08-2023 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. RE: Variables in Subroutines - jrmrhrb00 - 12-08-2023 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 RE: Variables in Subroutines - WhTurner - 12-08-2023 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 RE: Variables in Subroutines - litdev - 12-08-2023 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? RE: Variables in Subroutines - jrmrhrb00 - 12-08-2023 LitDev, Yea, mine works now too. Sometimes things don't work then they do. I'll work on it later. Thanks JR RE: Variables in Subroutines - jrmrhrb00 - 12-09-2023 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 RE: Variables in Subroutines - Scout - 12-09-2023 HBWL61.000 cannot be imported RE: Variables in Subroutines - litdev - 12-09-2023 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. RE: Variables in Subroutines - jrmrhrb00 - 12-09-2023 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 |