Basic: At runtime how do I best investigate values inside variables and find available resources?

Is there a tool to introspect Basic’s run time values, showing value type, and value content depending on type, and allowing one to click through the object tree to find available resources?

(Because I think this is very useful to many here who want to write some Basic code, and because one excellent answer to this question was burred in the comments of a seemingly unrelated question here, I thought I’d ask this again, but more prominently. In a moment I’ll provide one answer to this question, as provided by karolus.)

Your question as presented only needs the basic editor window for coding and to set watches and breakpoints - variables. If, however, you want to inspect objects (more likely scenario) then you need a tool like MRI or Xray. Having used both, they are about the same and it is a personal preference to use MRI. Also there is a set of macros (this post near bottom) to allow selection during while say a form is live as opposed to inserting a statement in the code (although that has some benefits). Sample screen of "Navagation Bar’:

Get MRI extension here. Tutorial here.

Get Xray here.

Karolus suggested trying the MRI extension.

One way to invoke MRI in Basic is like this:

Sub PushButton(oEvent As Object)
End Sub

Now LO has these old versions available. But I suggest you try this newer version which I got to work with LO Presently there is a problem installing it, which has been reported, but here’s how to get around that until it’s fixed:

After you download MRI-1.3.3.oxt, make a copy of it called MRI-1.3.3_no_help.oxt. (Tip: don’t use spaces in your filename as it won’t like it later.) Then open MRI-1.3.3_no_help.oxt with your archive manager (file-roller in Linux Debian) and

  1. delete the /help subdirectory and
  2. edit /META-INF/manifest.xml with a text editor and delete the line for help, save, and update the archive,

and then install MRI using LO | Tools | Extension Manager | Add | Select MRI-1.3.3_no_help.oxt | Scroll down and Accept the license.

(Bug: Without removing and unhooking /help it hangs on install, but if installed a 2nd time it works.)

For temporary help: get help here.

Mri 1.3.2 installs without a problem. Mri oEvent works - don’t need parenthesis. Also see link to extra macros in my answer to run ‘on-the-fly’. Examine right in the middle of processing without setting a line of code. Also these is somewhat of a tutorial.

@Ratslinger, both 1.3.2 and 1.3.3 hung for me. Thanks for syntax simplification tip, and your amazingly quick answers. Any idea of how to correctly set MRI | Tools | Configuration | SDK Directory to point to LO (something like this) rather than to OpenOffice api, although they are clearly mostly the same?

No way I know of. They both use different ways to get to their respective locations. The URL’s are very different. Surprised 1.3.2 hung - used on at least four different OS’s without a problem.

@Ratslinger, k, I’ll ask Hanya if he has any plans to suport LOapi. And I must have something screwed up w/ help somewhere. Need help to get help. lol Thanks.

You can also try using unopkg from terminal to add, reinstall, and remove extensions. It doesn’t hang for me, but help still does not work.

MRI help is in the LO offline help - F1.

@Ratslinger, Wow. Thanks! Stumbled on this a few hours ago. Wish I’d had this long ago as it is so much faster to look up stuff!!!

To others: you need to install HELP FOR OFFLINE USE from here. (But you first might need to click green change? link, to right of Main Installer button to select your distro type. It’s not really obvious that these two download buttons are linked this way.)

This page has instructions as to how to use the code generation in MRI. What a neat, but hidden feature!