Nuno
Junior Member
Posts: 64
|
Post by Nuno on Feb 21, 2023 13:39:54 GMT -5
Hi all,
New to Liberty Basic, but not to programming. Just downloaded and installed a demo version, looking around on how it works and what can do. So far looks very impressive and easy to use. Guess I'll become a fan. However, there's a few bits that I don't like, and was wondering if it is possible to change them, and how: - The text editor included in Liberty Basic, has a white background with mostly greyish letters, among others as required Is there a way to change these colours within L.B.? In case the answer is no, can I use some other external editor, and "import" it's contents into L.B.? (Other than changing Win desktop colour settings, and copy paste the text from Notepad, word or other) - I've noticed that some code, such as: 10 GOTO 10, always prevents shuting down the running window. Have to use Win Task manager for this. Am I doing something wrong? or is there a better way of stopping and closing the running windows? (Kill drop down menu doesn't work)
Thank you Nuno
|
|
|
Post by Walt Decker on Feb 21, 2023 14:58:47 GMT -5
In the help, look at TextEditorColor$
To close a window use:
PRINT #MNYWINDOWHANDLE, "TRAPCLOSE [YourCloseLable]" OR PRINT #MNYWINDOWHANDLE, "TRAPCLOSE YourCloseSUB"
Then set up either a branch lable:
[YourCloseLable] CLOSE #MNYWINDOWHANDLE END
OR as SUB:
SUB YourCloseSUB WinHndl$
CLOSE #WinHndl$ END
END SUB
|
|
|
Post by tsh73 on Feb 21, 2023 15:37:09 GMT -5
Not that I'm aware of Sure, just make sure checkbox under "setup \ Preferences\ Reload file on activate" is set Open a file in LB Open same file in your favourite editor (I use Notepad++) save file (usual Ctrl-S) and Alt-Tab to LB Viola! New version already loaded in LB, ready to be compiled/debugged/whatever Also (I believe there is a topic in a helpfile, "Using external editor" or the like.) I use Notepad++ for lengthy code, see libertybasiccom.proboards.com/thread/952/notepad-syntax-file-liberty-basicjustbasiccom.proboards.com/thread/628/using-notepad-external-editorWell you kind of got what you asked for - busy loop. LB is busy executing your program, has to time for checking Windows events Now if you have an idea that your program might end up in busy loop (or if you just end up killing your program with task manager), put a SCAN inside a loop. It will serve as a place for a possible break (closing with top right red cross, whatever). Also checkbox under "setup \ Preferences\ Create *.BAK file on Run/Debug" saves file on Run in the folder, even if your forget to save it yourself. MIGHT get REALLY handy.
|
|
|
Post by Brandon Parker on Feb 21, 2023 20:16:37 GMT -5
For large projects, I also use an external editor that allows me to either run the saved program from the menu (or hotkeys) via Liberty BASIC or first send the program to my own LB preprocessor, the Import Architect. {:0) Brandon Parker
|
|
Nuno
Junior Member
Posts: 64
|
Post by Nuno on Feb 22, 2023 12:34:09 GMT -5
Sure, just make sure checkbox under "setup \ Preferences\ Reload file on activate" is set Open a file in LB Open same file in your favourite editor (I use Notepad++) save file (usual Ctrl-S) and Alt-Tab to LB Viola! New version already loaded in LB, ready to be compiled/debugged/whatever- I've noticed that some code, such as: 10 GOTO 10, always prevents shuting down the running window. Have to use Win Task manager for this.Well you kind of got what you asked for - busy loop. LB is busy executing your program, has to time for checking Windows events Now if you have an idea that your program might end up in busy loop (or if you just end up killing your program with task manager), put a SCAN inside a loop. It will serve as a place for a possible break (closing with top right red cross, whatever). Also checkbox under "setup \ Preferences\ Create *.BAK file on Run/Debug" saves file on Run in the folder, even if your forget to save it yourself. MIGHT get REALLY handy. External editor works!
The "setup \ Preferences\ Create *.BAK file on Run/Debug" thing was ON by default. Good to know this exists
Yes, something inside a loop that can get stuck would certainly do the trick. Issue is, in all other programming laguage editors I've used in the past, there's always a way to "STOP" or "KILL" a running program. L.B. seems to be the first that doesn't have such feature. Guess I just have to be extra carefull with my loops.
Thanks for your help.
|
|
|
Post by Rod on Feb 22, 2023 13:20:43 GMT -5
Ctrl+ Break should halt a run away loop but often Liberty is whizzing round and seems to ignore you. Not every keyboard has a Break key. Ctrl+Alt+Delete will stop the program but all you can do is close it. If however you remember to put a scan inside the loop things get more controllable.
|
|
|
Post by Brandon Parker on Feb 22, 2023 19:18:58 GMT -5
The infinite loop that you show is not a fault of Liberty BASIC. This type of loop can be created in most other languages. It depends on how you execute the code as well. If you execute the code using the Debugger, you will be able to control the program as you would expect.
The SCAN and WAIT commands are dedicated to allowing LB to check for events in its message queue that need to be processed. Without these commands being encountered by the runtime (or debugger), LB does not check for messages and thus has no idea you are trying to stop the running code.
{:0)
Brandon Parker
|
|