Fwd: {Thor} One last tool from me and Matt Slay ... let's try this again

65 views
Skip to first unread message

Jim Nelson

unread,
Feb 7, 2022, 2:32:48 PM2/7/22
to foxpr...@googlegroups.com
Hey everybody --

Attached is the source code for Explorer (hoping this will be work better than my last attempt).  For each of the attached files, remove the TXT extension and you should end up with two SCXs and one VCX.

You should be able to use this right out of the box.  As noted in my previous message, I assign a hot key, whether in production, in development, or when writing code in IDE:

On Key Label F9   Do Form Explorer_Modal with Sys(1270)

You can invoke Explorer at any time by hovering over any object in any form and using the hot key, and Explorer will open for that object and the form it belongs to.


We have found this to be an invaluable tool that lets you get inside forms while they are running in production.


There are also some very pleasant unanticipated uses.  Try any of these:

  • Do Form Explorer_Modal with _Screen
  • Using the hotkey over a form in the IDE, such as GoFish, PEMEditor, or Thor, will let you view their insides.  Since Explorer is a form as well, you get use it to spy on itself.
  • Using the hotkey over a form or class you are editing in the IDE works like a reduced-function version of the Properties Window or PEMEditor.  A curiosity, maybe, but navigation is easy and so is modifying properties.
  • Make the following little piece of code available in your app (for me, available from a context menu available only to Devs).  It created a collection of ALL your open forms to browse.

Local loForms As 'Collection'
Local lnI

loForms = Newobject('Collection')
For lnI = 1 To _Screen.FormCount
    m.loForms.Add(_Screen.Forms[m.lni])
Endfor
Do Form Explorer_Modal With m.loForms, 'All Forms'


A few technical notes:
  • This does not depend on Thor being installed (amazing, eh?) 
  • The three files in this release are intended to be self-contained and have no external references. 
  • The VCX is the base which Matt and I worked on and shared.  (If anybody were to make changes to share with the group, they should be in the VCX)
  • The SCXs are our forms where we customized the base VCX as desired.
  • I always use the modal form in production.  (Use the modeless form at your own risk.)  You may well choose to change some of the native form settings as appropriate for your environment.
  • Nodes are added to the TreeView only when you expand a parent node.
  • The grid on the right is recreated each time you click a node.
  • The filter box finds all matches in either the property name or value.
  • There is a browse button at the bottom left, available if Explorer (known as Dora to her friends) can determine the cursor related to the current node (such as a grid or column in a grid)
  • There are a number of properties and methods, in both the form and its main object "TreeContainer", available for customization.  These are easily accessed using PEMEditor, as they are are Local .  There's a description field for each.

              image.png


It may seem odd that most of the customizable properties and methods are in the object TreeContainer, rather than in the form.  This is by design; Matt's use of this was to embed the TreeContainer into his own form in his app, my use is to have a stand-alone form.

P.S.: Offered as-is.

Enjoy!



On Wed, Feb 2, 2022 at 4:29 PM Jim Nelson <jimrn...@gmail.com> wrote:

Hi everybody --

 

In honor of my very good friend, the late Matt Slay, I want to share the last tool we collaborated on.

 

The tool is not actually our concept at all, as it derives from two other tools that have been in the community for a long time (see the original message, below, that got us started.)

 

 

All that we did was to customize an existing tool, add some features, eliminate some bugs and provide some customization.  (Actually, not much to get excited about.)

 

It's called rather simply:     Do Form Explorer with (Object Reference)

 

The trick to making this a really valuable tool was to find the following unexpected way to call it.  We have added the following line of code into our production code and also for use in our IDE: 

On Key Label F9   Do Form Explorer with Sys(1270)

You can invoke Explorer at any time by hovering over any object in any form and using the hot key, and Explorer will open for that object.

 

We find that this is invaluable in Production; it also works in IDE the same way although we do not use it there as often.

 

One last thing:  a hidden UI feature is the ability to edit properties by double-clicking in the value column of the grid.  You can also view and edit properties of arrays the same way.

 

Peace.

 



---------- Forwarded message ---------
From: Matt Slay <matt...@jordanmachine.com>
Date: Sat, Nov 18, 2017 at 6:32 AM
Subject: *NEW* Object Explorer...
To: Jim Nelson <jimrn...@gmail.com>


I've always used Tamar's Object Inspector in my deployed app in a hidden way, in that on from any CRUD forms, I can right click on the icon in the upper left of the form, and I can use the Object Inspector to see everything on the MainBO, which, is a *lot* of automatically populated stuff from my wwBusinessPro trickery.  I find this helpful to dig around on some of the data that is probably on the data objects but may not be display on the forms, and sometimes I need that data for various reasons.

Anyway, I have this one BO that Object Inspector chokes on when it parses the object to fetch all the data to show on the form. I racked by brain and screwed around with my BO for a couple of hours thinking it was some junk I had in my object hierarchy. I never could figure it out. It caused "a too many nested do loops " error on my BO for some reason that did not happen at run time, and I could not cause the same error on that BO from the command window, no matter what I tried to call or invoke.

Then on a whim I used an old tool I got from Mike Feltman's 2008 SWFox session on Collections. (The tool works on arrays and nested objects too, so it's not just about Collections, so the name Collection Explorer was ill-chosen if you ask me). That tool parsed the BO just fine and never triggered the same error on my BO methods as it parsed the BO. Go figure!

So, I am relieved about that and I'm switching away from Object Inspector to this new tool.

One cool thing about his tool is that it is only one single SCX form.  No classlibs at all, no .APP file, no dependencies on anything but native FoxPro controls. The original form had 3 controls and that's it.  I added a 4th control as a label in the bottom right hand corner. It it very lightweight, and only have about 8 methods to do everything.  Very easy to follow code, very clean and simple.

I've also added some other functionality, like if one of the property values in the grid is a cursor name, you can double-click on it to browse that cursor. Tthe tools runs against the current data session that it was called from, so it can see and browse those cursors with double-click. (All of my child BO's store the cursor name in a property, and there are other cursor names references in other properties, so it's handy to fire off a Browse from any cursor name.)

I also renamed this tool to Object Explorer (not to be confused with Tamar's Object Inspector).

It is now "Object Explorer 2.1.0" so far. I may release it on VFPx Githib, or at least put it up on my own GitHub and shoot out a tweet and a few emails about it to get some feedback.

So, I've dumped Object Inspector for this new tool.


    Do Form Object_Explorer with Thisform.oMainObject, "Job", "4033X"



--
Matt Slay, President
Jordan Machine Co.
355 Clow Lane
PO Box 170339
Birmingham, AL 35217
Ph: 205-849-5050
Fx: 205-849-5075
matt...@jordanmachine.com
http://www.JordanMachine.com





--
Jim Nelson

(805) 498-9195 (preferred)
(720) 837-3536 (cell)

--
You received this message because you are subscribed to the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to FoxProThor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/FoxProThor/CAEAD%3DvO6Ms92%3D67NYz3OzTQnn0rpOFsk3YdZZkBC-n%2BQ7Jk_JQ%40mail.gmail.com.


--
Jim Nelson

(805) 498-9195 (preferred)
(720) 837-3536 (cell)


--
Jim Nelson

(805) 498-9195 (preferred)
(720) 837-3536 (cell)


--
Jim Nelson

(805) 498-9195 (preferred)
(720) 837-3536 (cell)


--
Jim Nelson

(805) 498-9195 (preferred)
(720) 837-3536 (cell)
explorer.sct.txt
explorer_modal.SCT.txt
explorer.scx.txt
explorer.vcx.txt
explorer.vct.txt
explorer_modal.scx.txt

Tore Bleken

unread,
Feb 8, 2022, 8:07:40 AM2/8/22
to FoxPr...@googlegroups.com

Hi Jim,

 

I'm testing the forms right now. I found one glitch, other than that I am really impressed, nice work!

 

The glitch I refer to, is that in both the scx forms you have set the property cSettingsFileName into "C:\Visual FoxPro\Explorer_Modal_Settings.DBF", IOW you use a hard coded path which doesn't necessarily exist on the user's machine. The form frmexplorer in explorer.vcx has this property set to "=Addbs(Sys(2023)) + 'ExplorerSettings.dbf'", which is what I guess most people want.

To fix this, simply blank this property on both forms.

 

Tore Bleken

Hey everybody --

              

 

It may seem odd that most of the customizable properties and methods are in the object TreeContainer, rather than in the form.  This is by design; Matt's use of this was to embed the TreeContainer into his own form in his app, my use is to have a stand-alone form.

 

P.S.: Offered as-is.

 

Enjoy!

 

 

 

On Wed, Feb 2, 2022 at 4:29 PM Jim Nelson <jimrn...@gmail.com> wrote:

Hi everybody --

 

In honor of my very good friend, the late Matt Slay, I want to share the last tool we collaborated on.

 

The tool is not actually our concept at all, as it derives from two other tools that have been in the community for a long time (see the original message, below, that got us started.)

 

 

All that we did was to customize an existing tool, add some features, eliminate some bugs and provide some customization.  (Actually, not much to get excited about.)

Jim Nelson

unread,
Feb 8, 2022, 10:44:10 AM2/8/22
to FoxPr...@googlegroups.com
Thanks, Tore!

I suggest that instead of blank out those properties, you reset them to default.

In any case, I have attached corrected versions. 



explorer.SCT.txt
explorer.vcx.txt
explorer.scx.txt
explorer_modal.SCT.txt
explorer.vct.txt
explorer_modal.scx.txt

Tore Bleken

unread,
Feb 9, 2022, 11:20:29 AM2/9/22
to FoxPr...@googlegroups.com

Hi Jim,

 

I have played with this tool, and I must confess that I really liked it. I showed it to my son, and he immediately implemented it in our company's POS system. All the beta testers have access to it via a "hidden" key combination. If they change anything to either fix something, make it prettier or whatever, they make a screenshot and send it to my son.

 

This made us realize that one feature is kind of "missing". And that's a way to list all the changes you make, if any, during a session. Something like a table or a text file where all the changed properties were listed, along with the old and new values. Any comments?

Jim Nelson

unread,
Feb 10, 2022, 12:41:19 PM2/10/22
to FoxPr...@googlegroups.com
Tore --

Hey, great to hear that you have found this Explorer tool for objects and collections of enough value to incorporate into your production app!

I have always appreciated your input (after all, Thor is named after you) and once again you have made a suggestion for a significant improvement.

Just for you (and anybody else who's interested), I've added a new hook in the TreeContainer class, a method named LogChange, which is called each time any property is changed (by double-clicking in the grid's value column).

The parameters should contain all the information you might want to record for later review.  A reminder: you will want to make your changes in whichever SCX you use, not in this base class.

image.png


explorer.vct.txt
explorer.vcx.txt

Tore Bleken

unread,
Feb 10, 2022, 3:00:54 PM2/10/22
to FoxPr...@googlegroups.com

Hi Jim,

 

Thank you for adding this feature, I will "play" with it tomorrow.

 

Tore Bleken

 

From: foxpr...@googlegroups.com <foxpr...@googlegroups.com> On Behalf Of Jim Nelson
Sent: torsdag 10. februar 2022 18:39
To: FoxPr...@googlegroups.com
Subject: Re: {Thor} One last tool from me and Matt Slay ... let's try this again

 

Tore --

 

Hey, great to hear that you have found this Explorer tool for objects and collections of enough value to incorporate into your production app!

 

I have always appreciated your input (after all, Thor is named after you) and once again you have made a suggestion for a significant improvement.

 

Just for you (and anybody else who's interested), I've added a new hook in the TreeContainer class, a method named LogChange, which is called each time any property is changed (by double-clicking in the grid's value column).

 

The parameters should contain all the information you might want to record for later review.  A reminder: you will want to make your changes in whichever SCX you use, not in this base class.

 

 

Reply all
Reply to author
Forward
0 new messages