Ask Your Question
0

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

asked 2016-12-20 03:18:07 +0200

EasyTrieve gravatar image

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.)

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2016-12-20 03:51:56 +0200

Ratslinger gravatar image

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':

image description

Get MRI extension here. Tutorial here.

Get Xray here.

edit flag offensive delete link more
0

answered 2016-12-20 04:11:04 +0200

EasyTrieve gravatar image

Karolus suggested trying the MRI extension.

image description

One way to invoke MRI in Basic is like this:

Sub PushButton(oEvent As Object)
    Globalscope.BasicLibraries.LoadLibrary("MRILib")
    mri(oEvent)
   ...
End Sub

Now LO has these old versions available. But I suggest you try this newer version which I got to work with LO 5.2.3.3. 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.

edit flag offensive delete link more

Comments

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 gravatar imageRatslinger ( 2016-12-20 04:21:09 +0200 )edit

@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 | OpenOffice.org SDK Directory to point to LO (something like this) rather than to OpenOffice api, although they are clearly mostly the same?

EasyTrieve gravatar imageEasyTrieve ( 2016-12-20 04:55:40 +0200 )edit

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 gravatar imageRatslinger ( 2016-12-20 05:46:19 +0200 )edit

@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.

EasyTrieve gravatar imageEasyTrieve ( 2016-12-20 19:41:00 +0200 )edit

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.

EasyTrieve gravatar imageEasyTrieve ( 2016-12-20 20:24:30 +0200 )edit
1

MRI help is in the LO offline help - F1.

Ratslinger gravatar imageRatslinger ( 2016-12-20 20:30:14 +0200 )edit

@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.)

EasyTrieve gravatar imageEasyTrieve ( 2016-12-21 07:45:14 +0200 )edit

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

EasyTrieve gravatar imageEasyTrieve ( 2016-12-21 08:38:35 +0200 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2016-12-20 03:18:07 +0200

Seen: 174 times

Last updated: Dec 20 '16