Share My Creation Device Basic language IDE

Discussion in 'Share Your Creations' started by agraham, Dec 18, 2010.

  1. agraham

    agraham Expert Licensed User

    Unfortunately without a Device IDE it is no longer possible to whip up quick and dirty programs on an Android device like we could with Basic4ppc on Windows Mobile.

    I realised that my BasicLib script interpreter library only lacked one thing that stopped it being used as the basis for an interpreter for a device IDE and that was that it didn't support any means of responding to external events so all it could do was run linear code then exit. Fine for scripts but not for a user driven application that spends most of its time suspended waiting for events to happen. So I added it!

    As well as being able to respond to events a program needs to be able to interact with the platform to add controls and access the GUI, file system and other OS services. Unlike previous versions of BasicIDE, which used the normal BasicLib library and relied upon the "Sys" function to call methods, version 2.2, and future, versions use a new BasicLibIDE library that "knows" about the methods in Script.bas so the platform functions are now embedded in the script language. It is important that the version of Script.bas matches that of the BasicLibIDE library as both need to be modified in parallel to add new functions to the language.

    The previous Sys and CallHostSub functionality is of course still available.

    The demo program here supports the most important views, and their events, for small programs and has graphics and file handling support. Look at Readme.txt for instructions and the comments in the Script module to see what is implemented there.

    EDIT :- See post #7 for a suggestion to add Invalidate to the Script module

    EDIT :- Version 2.0 posted. See post #8 for details.

    EDIT :- Version 2.1 posted. See post #9 for details.

    EDIT :- Version 2.2 posted. See post #15 for details.

    EDIT :- Version 2.2a posted with the BasicLibIDE library included. See post #17 for details.

    EDIT :- Version 2.3 posted. See post #18 for details.

    EDIT :- Version 2.4 posted. See post #20 for details.

    EDIT :- Version 2.5 posted. See post #23 for details.

    EDIT :- JesseW has posted his improved version of the IDE itself, see post #32 for details. You will still need the BasicLibIDE jar and xml from the archive in this post.

    EDIT :- Version 2.6 posted. See post #47 for details.

    EDIT :- Version 2.7 posted. See post #51 for details.

    EDIT :- Version 2.8 posted. See post #52 for details.

    EDIT :- Version 2.9 posted. See post #79 for details.

    EDIT :- Version 2.91 posted. See post #87 for details.

    EDIT :- Version 2.92 posted. See post #92 for details.

    EDIT :- Version 2.93 posted. See post #95 for details.

    EDIT :- Version 2.94 posted. See post #100 for details.

    EDIT :- Version 2.95 posted. See post #118 for details.

    EDIT :- Version 2.96 posted. See post #138 for details.

    EDIT :- Version 2.97 posted. See post #140 for details.

    EDIT :- Version 1.98 of BasicLibIDE is posted below. Use this instead of the version in BasicIDE2.97.zip. It fixes a problem with Call and CallSub.
     

    Attached Files:

    Last edited: Jan 10, 2014
    koaunglay likes this.
  2. JesseW

    JesseW Active Member Licensed User

    Andrew, I am VERY interested in an IDE for my DX. So, I'm watching your BasicLib very closely, and was glad to see you added functionality in this IDE thread.

    But I can't seem to find the idetest.src you mentioned. Did you forget to put it in the zip you uploaded, or is it to be found elsewhere?

    I am simply amazed at your participation. Please keep up the good work :sign0162:

    Ps. On an off note, with the addition of the Sys command, we should now be able to access just about everything, including the omitted files and graphics, correct? Do you foresee adding native file and graphic support anytime soon?

    Jesse
     
    Last edited: Dec 18, 2010
  3. agraham

    agraham Expert Licensed User

    :signOops: Sorry, I missed out the demo script from the archive and didn't notice when I tested the release as it was already on my device. It is now included in the archive so re-download to get it.
     
  4. agraham

    agraham Expert Licensed User

    Not sure what you mean by "omitted files" but if you place a method in the Script module you can call it with the Sys function and it can do whatever you want as long as its parameters are all of type String and any return is a String. If you look at what is already implemented in the Script module you will see that you can move array data to and from the interpreter at runtime - the file functions do that.

    By the way Sys is only a new name for CallHostSub which was there before. The only new functionality in 1.2 is the Call method used to implement event callbacks into the interpreter.

    Not sure. Sys is not that inefficient performance-wise compared to implementing the function in the interpreter and it looks much the same to write and hence read so I'm not sure that losing the flexibility to change any of the platform specific functions easily is worth the effort of including more stuff in the interpreter.
     
  5. JesseW

    JesseW Active Member Licensed User

    I meant native support for file access (and graphics) was omitted, which you answered in the next paragraph.

    To me, it seems better, and more readable, to access things by name, as it's been since the inception of the language, like Open 1, "myfile", "r" and ReadLine 1, a$ and Close 1 than is a series of Sys commands, even though the outcome is the same. I'm relating from an IDE users standpoint, not the one coding the IDE itself. But I'm not the one coding the IDE, and I am VERY grateful just to have it in the first place.

    I'd like to contribute something, which I will add in the next post :)

    Jesse
     
  6. JesseW

    JesseW Active Member Licensed User

    BasicLib IDE Help File

    The first thing I did was put the .chm files on my Droid X and try opening them. No luck. :sign0148: So I converted them to HTML and uploaded them here, formatted for mobile devices. I suppose you could extract and use them anywhere, but I put mine one the sdcard/BasicLib folder. Use a file browser to navigate to the B4ScriptHTMLHelp folder and touch the index.html file to start the help system in your favorite web browser. Then you can touch the [Home] key and start the IDE. Then, you can alternate between the IDE and help system by touching and holding (called a long-touch??) the [Home] key to bring up either Running or Recent programs, depending on your version of Android.

    I hope this helps someone. I intended to look at the IDE code and implement a Help menu item, but I just ran out of time. Hint...Hint...

    Jesse
     

    Attached Files:

  7. agraham

    agraham Expert Licensed User

    If your graphics are not appearing when you think they should you may need call Invalidate on the ImageView. Add add this method to the Script module and call it when you have finished drawing.

    Code:
    ' Invalidate the ImageView
    Sub Invalidate(imageviewname As String)
      
    Dim v As View
      
    Dim iv As ImageView
      
    For i = 0 To Activity.NumberOfViews - 1
        v = 
    Activity.GetView(i)
        
    If v.Tag = imageviewname Then
          
    If v Is ImageView Then
            iv = v
            iv.Invalidate
            
    Return
          
    End If
        
    End If
      
    Next
    End Sub
     
  8. agraham

    agraham Expert Licensed User

    Version 2.0, now posted, is a significant upgrade from version 1.0, please make sure you read Readme.txt as the default folder name is different than before. It now includes support for 480x800 Density 1 devices and a lot more Android device functionality is exposed to the interpreter. I've even added a method of platform help production. Of course you can always modify it to suit yourself if you need something that I have omitted. I am quite pleased with this device IDE. While the editor is a bit fiddly to use on my small phone it is pretty good on my 7" slow cr*p Chinese tablet where the only problem is the lack of performance of the device. It's not as bad as on the emulator though! :)
     
    Last edited: Jan 3, 2011
  9. agraham

    agraham Expert Licensed User

    Version 2.1, now posted, includes a Help menu option which displays a selected html file. Also included are two help files, one for the B4Script language and one for the IDE Sys functions.

    The html is displayed with the Android HTMLviewer. If the links in the displayed help file do not work then exit the help by the back button and try again. This seems to be a bug in HTMLviewer. While Googling I have seen other comments about it occurring for other people.
     
  10. JesseW

    JesseW Active Member Licensed User

    Is there a way to make a home screen shortcut to a .src file and invoke the ide to run the script? Perhaps with an autorun param. Then when the src file exited, the ide would close too, giving the appearance of a standalone program or utility.
     
  11. agraham

    agraham Expert Licensed User

    I'm afraid that it is not as easy to do that sort of thing in Andoid as in Windows or Windows Mobile.

    If/when Erel provides a facility for including custom intent filters in the manifest that would make possible a runner app that would run a script when it was clicked in a file manager. I think only launchable activities and widgets can be placed as a shortcut on the home screen.
     
  12. Jim Brown

    Jim Brown Active Member Licensed User

    Hi Andrew

    I am having fun playing around with BasicIDE. Nice time-killer!
    Since I wanted more screen real-estate I modded the IDE (adding more space and code injection)
     
    Last edited: Apr 16, 2011
  13. agraham

    agraham Expert Licensed User

    :sign0098: I hope you'll post it once you've got it polished and working!
     
  14. agraham

    agraham Expert Licensed User

    Version 2.2 now posted uses a modified BasicLib library that now knows about Script.bas so the platform functions that previously had to be called by the Sys keyword now appear to be part of the language.

    This was a big typing job to incorporate the Script.bas functions into the new BasicLibIDE and so there may be some errors that occur due to typos. Please post if you come accros any. Also to incorpporate additional functions into the script language both Script.bas and BasicLibIDE will need to be modified in tandem. If you do add your own stuff to Script.bas it can still be called using Sys or CallHostSub.
     
  15. tech2k

    tech2k New Member Licensed User

    Agraham,

    I just tried to build your latest 2.2 and the compile errors at line 5 because I don't seem to have the new BasicLibIDE. Your version 2.1 builds/installs/runs fine on my droid 1. I have the BasicLib 1.3 and your dialog and reflection libs but cant seem to find the BasicLibIDE anywhere (am I blind or just dumb?). I think BasicIDE is the coolest app I have ever had on my droid. Thank you for this.
    Ken
     
  16. agraham

    agraham Expert Licensed User

    No, it is me that is dumb. :eek:
    Because BasicLibIDE is so closely tied to the Script activity module I am not going to post it separately so I intended to include it in the archive - but didn't. :(
    The archive now posted includes it.

    Thank you, I'm happy somebody finds it useful. :)
     
  17. agraham

    agraham Expert Licensed User

    Version 2.3 now posted has a bug fixed that caused problems when calling a Sub from an Event. The archive includes BasicLibIDE version 1.4.

    There is no longer a limit to the number of menu items that can be added.
    I've also added added InputFile and InputNumber dialogs and OpenMenu and CloseMenu although CloseMenu seems of little practical use as touching anything while the menu is showing will close it.

    My CollectionsExtra library is now needed to compile BasicIDE as FillArray, SortArray and SearchArray have been added.
     
  18. TheDevMan

    TheDevMan Member Licensed User

    Wow, Great stuff. Works very well.:sign0060:
     
  19. geocomputing

    geocomputing Member Licensed User

    Hi,

    I really like the idea of using B4A on the device, but the layout didn't scale right for my tablet (most of the controls were offscreen). That seems to be a common problem with android devices I use so I decided to change the layout file and code to programmatically lay out the controls. It now works on QVGA, HVGA and tablets, and presumably most other screen resolutions.

    I thought I'd share this here as others may have difficulty getting the device ide working on their androids. If so, I've attached a zip file with a new layout file and basicide.b4a file. The layout file now just has a variant for portrait hvga, and the only change to the b4a file is the positioning and sizing of controls in the activitycreate sub.

    Excellent job writing the device ide btw. Many thanks for it :)

    Best wishes,

    Andrew.
     

    Attached Files:

  20. agraham

    agraham Expert Licensed User

    Version 2.4 now posted removes two unintended limitations that I discovered in event handling.

    Firstly Event Subs can now call other Subs. Previously the event code terminated at the first End Sub or Return encountered.

    Secondly there is no longer a potential crash of the IDE if code in an Event Sub performs an action that causes a View event to be raised (like changing the Checked property of a View) that is then called directly immediately by Android and not through the application message queue.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice