Share My Creation BasicIDE Suite 3 - Now further improved

BasicIDE Suite 3 now superceded by BasicIDE Suite 4



Here we have (yet) another updated version of BasicIDE Suite, my on device development environment. The IDE is based on my CodeEditorView control that you could use in your own projects if you needed a syntax highlighting code editor. I haven't documented it separately as I suspect the limited demand for it would not justify the effort but would be pleased to answer questions about its use.

Significant changes from BasicIDE Suite version 2 are:

BasicIDE

1) Async dialogs are now supported using a callback mechanism. Synchronous ones are available but deprecated.
2) Because debugging formerly relied on the deprecated Msgbox it has been overhauled to be programmatically invoked using Async dialogs
2) A few typos and missing items in the syntax highlighting and autocomplete are fixed.
3) All array, variable and Sub names are now available to autocomplete, updated whenever Enter is pressed
4) New CodeEditorView v1.20 has a custom ArrayAdapter that needs no manifest entries or inline Java (cribbed from some of Erel's B4A code - thank you) and has Search background highlighting added.
5) Editor can now do find, search and replace
6) Clipboard access for text items added to the language because it was needed by one of my apps

BasicIDE Designer

1) Various minor enhancements and UI bugfixes
2) Added landscape layout capability so programs can now cope with device rotation

1620385264992.png


BasicIDE Launcher

1) Launcher app has been added to the suite to enable rapid launch of completed programs by selection from a list


Personal ramblings - skip if you can't be bothered reading it!

A little history for context. Way back in 2007 I purchased a Pocket PC, a Dell Axiom A30. It was a revelation! A small Windows 95 like computer running a compact version of .NET and Windows Forms. I also purchased a program called Basic4ppc so that I could program on the go with the Axiom as well as on the desktop and so I 'met' Erel.

All good things come to an end and with the demise of Pocket PC/Windows Mobile 6 and its replacement by the utterly awful, and ultimately doomed, Windows Mobile 7 and later series of OSes I reluctantly switched to Android, as did the creator of Basic4ppc and I became the first beta tester to help Erel develop Basic4Android that later became B4A.

Back in 2010 Erel was pretty pleased with himself for implementing a modal dialog in Android - only to deprecate it nearly 10 years later šŸ¤£
Hi Andy,
...
BTW, I've now started working more seriously on B4A. I learned a lot since 2005 when I first developed Basic4ppc so I'm pretty optimistic about this new project. Already implemented a good old blocking msgbox (was pretty complicated to do)
...
Regards,
Erel

I stopped using B4A in 2014 out of disgust with Google's business practices and for a while small Windows tablets looked promising. On them I could run my own private version of Basic4ppc which I have kept enhancing over the years into a full blown desktop IDE. However these small tablets never took off in the market and became unobtainable with any decent specification so in about 2018 I returned very reluctantly to Android, even more disgusted with Google but with no other alternative, and started relearning B4A which had grown somewhat during my absence.

I still wanted an on-device IDE and I have a Basic4ppc language interpreter that I wrote in C# for Basic4ppc and have kept polished over the years and which I had translated to Java and B4A as the BasicLib library. So I started implementing an on device development based upon it. Now with Basic IDE Suite version 3 we have the apotheosis of my efforts over the years.


BasicIDE Suite 3 details

This latest vesion of Basic IDE Suite has three components.

Basic IDE, the on-device development environment which uses the BasicLib B4A library to provide the language interpreter for the IDE. This latest version has a modified editor that provides syntax highlighting and auto-completion for the B4AScript language, the Basic IDE Script extensions and the variable and Sub declarations of the current program. It has error line highlighting together with search and replace. A major addition to the Script extensions are non-modal versions of the original modal user interface dialogs, and the elimination of modal dialogs from Basic IDE itself, apart from the script break and step facility which requires it. There is a discussion of modality and its implications in Basic IDE and its program in a topic in the help file for Basic IDE.

Basic IDE Designer, an on-device visual designer that is used to produce view layouts for use in Basic IDE programs. This latest version can provide both landscape and portrait variants.

Basic IDE Launcher, an app that can quickly run a selected Basic IDE program and whose project can very easily be copied, slightly modified and recompiled by B4A to produce a stand-alone APK of a Basic IDE program that can be installed to a device and run independently as a normal B4A app.

Before extracting the BasicIDEHelp zip file it should be unblocked by right clicking on it in File Explorer, selecting Properties and checking Unblock at the lower right of the General tab. This allows the .chm help files to be properly displayed by Windows. If the .chm files are not unblocked their content will not be available in the Windows help viewer. Read the BasicIDE chm help to get started. I note that the Installation topic in the Overview section implies that the help files are in BasicIDELibraries zip, they no longer are and now have their own archive.

If this all looks a bit daunting that is because it is, although once everything is in place on the device things are pretty straightforward. Remember that this is a full design and execution IDE for non-trivial Andoid apps so it was never going to be simple - I don't usually do simple. Enjoy :)

EDIT: There seems to be a bug in Android 11 keyboard handling that affects the Designer. See post #7 below.

EDIT2: The new IIF function in B4X v11.0 broke the Script module version replace it with the version in post #9

EDIT3: B4A v11 barfs on an unneeded manifest entry in the Launcher. Remove the last line

AddManifestText(<edtSource android:imeOptions="flagNoExtractUi|flagNoFullscreen" />)

EDIT4: See posts #15 and #16 for how to add a 'flinging' capability to the editor for much easier navigation
 

Attachments

  • BasicIDE_5.7.zip
    428.1 KB · Views: 458
  • BasicIDEDesigner_v1.2.zip
    223.5 KB · Views: 392
  • BasicIDEHelp.zip
    286.1 KB · Views: 405
  • BasicIDELauncher_v1.0.zip
    62.9 KB · Views: 373
  • BasicIDELibraries4.zip
    248.6 KB · Views: 397
Last edited:

agraham

Expert
Licensed User
Longtime User
a simple helloworld - add two numbers.
I think you missed the significance of the auto-generated statements at the beginning of the script such as
eda = StringToLower('eda')

This lets you write
a = GetText(eda)
instead of
a = GetText('eda')

which is both more convenient, saving a whole two characters :), and ensures that the control name will still be passed as a string if you accidently omit the quotes.
 

Peter Simpson

Expert
Licensed User
Longtime User
Hello Andy,
Wow this is excellent work. When I get an hour or ten I'm going to give this a right going over. You've obviously spent years developing and updating this IDE, really impressive.

So what exactly do you use it for as you said above "I still wanted an on-device IDE"???
 

agraham

Expert
Licensed User
Longtime User
So what exactly do you use it for
Playing around :) Making the odd small program when out when a calculator is inadequate. Occasionally it is useful - for instance my Redmi Note 9 Pro occasionally seems to forget how to rotate affecting all apps. Running the sensor test seems to start it working again.
 

agraham

Expert
Licensed User
Longtime User
There seems to be a bug or behaviour change with soft keyboards in Android 11, at least on my Pixel 4a, that doesn't manifest itself on my Android 10 device - I haven't tested earlier versions but I think they were OK as well.

It seems that with some keyboards if you tap on a view that has text then if you dismiss the Input Dialog by pressing OK or Cancel WITHOUT pressing Done on the keyboard the keyboard will pop up next time you tap a view even if it doesn't have any text to edit and will keep doing so, until you tap on a view with text then press Done before closing the dialog.

This seems to happen with Hackers Keyboard and Smart Keyboard Pro (my favourite :() but not with Gboard or Microsoft SwiftKey. Interestingly neither of these replace the Enter key symbol with Done when displaying the Input Dialog.
 
Last edited:

tech2k

Member
Licensed User
Longtime User
Please help,
This failed to compile on B4A v11.00 due to an error around line 722. The log says "iif is not a valid identifier" thanks.

Edit : I unpacked with 7zip and put the new libraries in my additional libraries directory. I use open Java 11.0.1 , resources_06_21 and commandlinetools-win-6609375-latest . This is the first version of BasicIDE I've had any problem compiling or installing and it shows that log error as soon as B4A opens it.

Edit #2 : I installed an older version of B4A v10.70 and was able to compile this newest version of BasicIDE v5.7 and install without a problem.
 
Last edited:

agraham

Expert
Licensed User
Longtime User
The new IIF function in B4X v11.0 broke the Script module version replace it with
B4X:
''@N:IfThenElse(condition, truepart, falsepart) As returnvalue
''IfThenElse is a function that performs an If...Else...End If as a one line statement.
''IfThenElse has 3 parts: a condition, a True part and a False part.
''The condition is evaluated, and if it evaluates true, the true part is returned, otherwise the false part is returned.
''It should not replace an If block that makes tests to ensure an error will not result.
''This is because both True part and False part are evaluated when the function is called.
''Example:
''# instead of this...
''If a = 5 Then
''&nbsp;&nbsp;b = b + 1
''Else
''&nbsp;&nbsp;b = b - 1
''Endif
''# use this...
''b = b + IfThenElse(a = 5, 1, -1)
Sub IfThenElse(condition As String, truepart As String, falsepart As String) As String
    'condition = condition.ToLowerCase
    If condition = "true" Then
        Return truepart
    End If
    Return falsepart
End Sub

EDIT: And remember to replace "IIF" with "IfThenElse" in the 'General functions' Blib.AddSysCalls.
 
Last edited:

JesseW

Active Member
Licensed User
Longtime User
Hi Andrew! just downloaded basicide 5.7. b4a 8.3 has maven artifact error when compiling. 11.0 complained about the iif until i fixed it. windows does NOT like to run basicidescript.exe btw, but finally got it to. and... when compiling the launcher, it stopped with an error because the reference to edtSource was still in it.I can't wait to try it out.

btw, i never quit using my trusty ole b4script. i had 2 apps on the play store, one had about 90,000 downloads before it finally petered out. I was REALLY hoping to have the first 100k b4script download =) but google didn't like my donation button so they suspended it and I took them both down. I'm attaching a screenshot of how my b4script finally evolved. by accident, the icons never showed with the keyboard up, and I never fixed it because that gave me more programming real estate.

But the more I read about your suite 3, the more i really like it. So I'm going to give it a try.
best wishes

ps... you already know, don't you, that i'll have a long list of suggestions hehe. here are a few to start with...
1. #include directive as seen in the screenshot
2. split and continue a line with <space>_<crlf> like vb and vbscript. this is an easy one: edtsource.text.replace(" _"&crlf,"") before sending to the script engine
 

Attachments

  • Screenshot_20210927-124904.jpg
    Screenshot_20210927-124904.jpg
    422.7 KB · Views: 208
Last edited:

JesseW

Active Member
Licensed User
Longtime User
I just opened basicide on my galaxy s10e for the first time and got errors. screenshots attached. it errored on both .txt files, although I only captured one of them
 

Attachments

  • Screenshot_20210927-203106.jpg
    Screenshot_20210927-203106.jpg
    133.3 KB · Views: 208
  • Untitled.png
    Untitled.png
    36.1 KB · Views: 200

agraham

Expert
Licensed User
Longtime User
When you unzipped BasicIDE_5.7.zip there should be in BasicIDE/Files four .txt files, two each for autocomplete and text highlighting. They should then be compiled into the apk in File..DirAssets from where they are loaded when the IDE starts. Your screenshot looks OK so I am puzzled.
2021-09-28_084649.jpg


Make sure you follow the 'Desktop Installation' and 'Device Installation' instructions in the Overview topic in BasicIDE.chm. The Desktop Installation topic section probably implies that the help files are in BasicIDELibraries zip, they no longer are and now have their own archive.
 
Last edited:

JesseW

Active Member
Licensed User
Longtime User
I tried the entire process again, and found that BasicIDEScript.exe did NOT in fact run the time before. I coaxed it into running as administrator and THEN copied the files to the files pane, as directed by the reminder, recompiled and it's starting without the error now. so... my bad lol

i'm re-reading the installation guides to make sure I didn't miss anything else.

did you get my note of the edtSource ref in the manifest?
 
Last edited:

agraham

Expert
Licensed User
Longtime User
did you get my note of the edtSource ref in the manifest?
Yes,thanks. I have added a footnote to the BasicIDE thread to point this out.
BasicIDEScript.exe did NOT in fact run the time before
Sounds like you may not have unblocked the Zip before extracting it.


Many thanks for the donation. To address your points, which I may or may not include in the future as there may or may not be a further release of BasicIDE Suite owing to a couple of ongoing medical problems. I might release just the BasicIDE project itself in a few weeks time as I have made a few very minor changes since v5.7 but nothing of real substance. The point of publishing all the source codes is that you can take it and modify it yourself to suit your own needs as the core interpreter is now very stable and everything else is in accessible B4A code.


#include directive.
If I did this when loading it to the interpreter I would read each include line, save the source name(s) and then add the included code at the end of program. This would at least keep the line numbers of the main program correct for any error reporting. Errors in the included code would then be reported as 'non-existent' line numbers which might require a sanity check in the Script.Blib_Ended event to avoid an exception in the editor if it tried to highlight the error line.

Line continuation
This would be fairly trivial but I would use edtsource.text.replace(" _"&crlf &crlf,"") with the additional blank line keeping the line numbering correct for error reporting. It's so simple you can easily try it.

'Fling' in editor.
I would if I could but I can't see how at the moment. I wanted to do that but couldn't see how so in its absence I implemented the 'Shrink' facility in the editor together with the Top and Bottom buttons which make navigating a little bit easier.

Chain
Yes, Chain should be solid now. If I remember correctly (it's a long time since I looked) your original try at it had the side effect of a possible stack runaway as it didn't unwind the stack when chaining as it didn't recreate the Script Activity - the current implementation does.
 

JesseW

Active Member
Licensed User
Longtime User
First and foremost, i pray your health issues improve!! you've been a valuable asset to this community as well as myself.

The point of publishing all the source codes is that you can take it and modify it yourself to suit your own needs
I understand, but if I take v5.7 and make it mine, with all the improvements I feel are worthy, and you then come out with v6.0, my efforts are wasted if I want the new features, or I have a monumental task of merging them in. and the project would split off into two different directions. If worthy suggestions are implemented at the source, they survive through new versions. That's how it was before when I heavily modified b4script. That's the reason I ask about them...

#include directive.
I understand. My only thoughts would be to create a new string variable of the entire program including all the include files, with markers of some kind at the insertion points, to send to blib, and if there was an error, you could parse backwards from it keeping track of the lines till you hit one of the markers, then load that file in edtSource and return to the ide with the highlight in the proper place. That's how I'd do it, with a whole lot of questions and donations šŸ¤«šŸ˜ Not sure if you're interested or not, but how I implemented them was to search the include file for the first sub and replace the #include with the code before the first sub. That let each include file have code in the initialization section. then the rest of the file was appended to the end. That would mess up the line numbers, tho, unless the marker specified the starting line number of the included section of code. it also kept track of the included filenames, just in case one was #included twice, in reality it'd only get merged into the source once. hope this all made sense. at the end of the day, being able to include commonly used routines and chop up massive projects into multiple files has been invaluable.

'Fling' in editor.
I would if I could but I can't see how at the moment.
here's how I managed to get it going in my version of b4script. I believe you helped me with it a long time ago lol. if memory serves me, this method takes the scrolling away from the edittext and gives it to the scrollview, which is by default fling enabled.

SVFling implementation:
'     in Sub Process_Globals
Dim svPos As Int

'    in Sub Globals
Dim svFling As ScrollView

'    in Sub Activity_Create
svFling.Initialize(100)
flingEnable

'    in Sub Activity_Pause
svPos = svFling.ScrollPosition

'    in Sub Activity_Resume
svFling.ScrollPosition = svPos

Sub flingEnable
    edtSource.RemoveView
    Activity.AddView(svFling, 0, 0, Activity.Width, Activity.Height)
    Dim args(3) As Object    'following code courtesy of AGraham
    args(0) = edtSource
    args(1) = -1
    args(2) = -2
    Dim types(3) As String
    types(0) = "android.view.View"
    types(1) = "java.lang.int"
    types(2) = "java.lang.int"
    Obj1.Target = svFling
    Obj1.RunMethod("removeAllViews")
    Obj1.RunMethod4("addView", args, types)
    Obj1.RunMethod2("setFillViewport", "true", "java.lang.boolean")
End Sub

I appreciate you discussing these things with me, going back and forth a little, but I don't want to wear out my welcome, so let me know if I need to slow down. Thanks again for all you do
 
Last edited:

agraham

Expert
Licensed User
Longtime User
Many thanks for the reminder about flinging, I totally forgot that way of doing it :( I was looking at doing it the hard way, natively in the CodeEditor view. I used your code as-is except I changed flingEnable a little to get the ScrollView the correct size and it seems to work a treat. šŸ‘

Enabling fling needs to be before any WaitFor statement as Resume then runs before Create returns and you get an unitialised error on svFling.
B4X:
'    in Sub Activity_Create
    ...
    IME.AddHeightChangedEvent
    Activity.LoadLayout("Layout") ' Two individual variants for full screen landscape and portrait
    DefaultTitle = Activity.Title & " v" & NumberFormat2(Version, 1, 2, 2, False)
    Activity.Title = DefaultTitle
    ' add fling capability, needs to be before any WaitFor statement as Resume runs then
    svFling.Initialize(100)
    flingEnable
    ...       

Sub flingEnable
    Dim width As Int = edtSource.Width
    Dim height As Int = edtSource.Height
    edtSource.RemoveView
    Activity.AddView(svFling, 0, 0, width, height)
    Dim args(3) As Object    'following code courtesy of AGraham
    args(0) = edtSource
    args(1) = -1
    args(2) = -2
    Dim types(3) As String
    types(0) = "android.view.View"
    types(1) = "java.lang.int"
    types(2) = "java.lang.int"
    Obj1.Target = svFling
    Obj1.RunMethod("removeAllViews")
    Obj1.RunMethod4("addView", args, types)
    Obj1.RunMethod2("setFillViewport", "true", "java.lang.boolean")
End Sub
 

agraham

Expert
Licensed User
Longtime User
For information.

I'm thinking further about #include as I see that it would be nice to have but your description of an implementation seems a bit complicated. I am currently favouring only supporting Subs in includes and appending them at the end on load with some line number massaging on error. It may be a while before I decide if and how.

I won't be implementing line continuation as the existing Wrap capability seems to be almost a duplicate function. But the change looks isolated and fairly trivial to back port to any later version if you did it yourself.
 

agraham

Expert
Licensed User
Longtime User
This would be fairly trivial but I would use edtsource.text.replace(" _"&crlf &crlf,"")
This is of course utter rubbish that I wrote without thinking - an all too frequent occurrence nowadays :(
While the JesseW original post would work it would then need additional logic to identify the real end of the statement and adjust the following line numbers accordingly by adding the requisite number of new line characters.

Enabling fling also requires changing the height of svFling instead of edtSource when the IME is shown and hidden and also saving the height of svFling for that purpose in Resume rather than that of edtSource. Also as a hack I found that sometime the Top button does not always work but the Bottom does so I changed btnTop_Click as follows.
B4X:
Sub btnTop_Click
    'this event has no effect immediately after loading and scrolling a script and in some other circumstances
    'observationally it always works after btnBottom_Click so as a hack that is what we do but we don't really understand why
    btnBottom_Click
    edtSource.SetSelection(0, 0)
    edtSource.RequestFocus ' seems to need this to show the selection
End Sub
Also put this in Activity_Create. It overrides the auto height calculation, which doesn't work within a Scrollview, and gives a fixed autcomplete list size.
B4X:
    'needed to add this when fling enabled otherwise get a single line autocomplete at the top of the screen
    edtSource.AutoHeight = Activity.Height / 4
 
Last edited:

agraham

Expert
Licensed User
Longtime User
Just to confirm - new update coming soon. I'm hoping that this next version is now fairly solid and feature complete.

Improvements
1) Minor UI changes and simplified IME handling internally. InputFile now has colour and text size options.
2) GNSS now returns Galileo information if available. UK National Grid to/from GNSS lat long transformations added.
3) Breaking changes to MessageBox and InputBox (which are deprecated anyway but do work still) to better match the Async functions.
4) IIF function removed and IfThenElse function added owing to clash with B4A v11.0
5) Editor supports 'flinging'. I'm pleased with this, it was an obvious missing feature. Thanks JesseW!
6) Script module supports #include. Subs only, no global definitions in included files but equivalent persistent values available by two new functions SaveValue(valuename, value) and RestoreValue(valuename) As returnvalue.

Any other suggestion before I wrap this up in a few days time? I need to write some #include tests before posting.
 

JesseW

Active Member
Licensed User
Longtime User
I had given b4script the concept of projects. if a program was run in the ide, dirAssets would point to its project dir, but when bundled with the launcher in an apk it would of course point to the real assets folder. when compiled into an apk, all one had to do is bundle all the files in the project folder and drop em in the files tab of the b4a launcher project. to me this pushed it up a notch as a serious development tool. if an include file couldn't be found it b4script/projects/thisproject folder, it'd look in the b4script/includes folder, similar to the additional libraries.

another consideration would be to add another set of up/down arrows that would jump to the last or next Sub. this would really be handy in larger projects.

I've been working on trying to code a preprocessor that'd handle includes the way I suggested, but my brain isn't as quick as it once was and you beat me to the punch lol, and you were right, it became very complex since it had to remember where every line of final code came from.

again, many thanks!
 
Top