Create a "Stop" command...

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
HwyStar
Enthusiast
Enthusiast
Posts: 101
Joined: Mon Apr 05, 2010 7:13 pm
Location: Reno, Nevada

Create a "Stop" command...

Post by HwyStar »

It would be nice to have a very simple "Stop" command built into the language...

Have the stop command basically do: MessageRequester("Stop",Your Dialog Here,#PB_MessageRequester_Abort | #PB_MessageRequester_Ignore)

The variable we pass into Stop would ignore the variable type and always display it in the "your dialog here" section. I use this command in Clarion everyday to quickly inspect the values of numbers or strings. Don't get me wrong - Debug is great but sometimes its nice to have the code stop at a specific spot and display your results without moving forward.

Code: Select all

  Define LongNum
  Define Str.s

  Stop(Str)
  Stop(LongNum)
  Stop("Var: " + LongNum)
If debugging is turned off then bypass the Stop command!

Thanks for listening Dudes!
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Create a "Stop" command...

Post by STARGÅTE »

you can use : CallDebugger

Code: Select all

Define LongNum
Define Str.s

Macro Stop(Variable)
 Debug Variable
 CallDebugger
EndMacro

Stop(Str)
Stop(LongNum)
Stop("Var: " + Str(LongNum))

but you can't mix Strings with Integers !
"Var: " + LongNum
never !
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Create a "Stop" command...

Post by Fred »

The IDE debugger shows the variable values when you put the mouse cursor on it, and the program is halted (just put a breakpoint).
User avatar
HwyStar
Enthusiast
Enthusiast
Posts: 101
Joined: Mon Apr 05, 2010 7:13 pm
Location: Reno, Nevada

Re: Create a "Stop" command...

Post by HwyStar »

I will give it a try Fred. I haven't used a debugger in years since Clarion has the Stop statement and it is so easy to use on the fly.

Thanks for the suggestions guys! :D
Mr Coder
User
User
Posts: 54
Joined: Tue Apr 13, 2010 8:02 am

Re: Create a "Stop" command...

Post by Mr Coder »

The program doesn't even need to be halted; just select the IDE while the program is running and hover the mouse over the variable in question.

You can also use the variable viewer to see their values during runtime, or set a watchlist with your favorite variables, or (with 4.50) set data breakpoints so your app halts when a variable becomes a certain value.
Post Reply