OBJECTINFO( Query

Hello Everybody,

I’m writing a macro to access the procedures that are associated with a form’s graphics. The objectinfo function allows this to be easily done.

myvar1 = objectinfo("procedures", ID, "Form_A, mydatabase)

But to use this function, you need to know the graphic’s unique ID. To get the unique ID, I suppose you use:

myvar2= objectinfo("id", ID, "Form_A, mydatabase)

But to use THAT function, you also need to know the graphic’s unique ID. Circular reasoning.

The Help says one could substitute the “name” of the object instead of the ID, but you don’t know the name of the object beforehand. And you can’t use objectinfo to find out the name, unless you know the unique ID!!!

There must be an easy answer to this, but I can’t see it.

Vic

The whole idea is that you should name the object beforehand by selecting it and naming it in the Measurements pane of the Properties panel under Attributes.

That name is now permanent and can be used in any procedure into the future and it will not change unless you change it yourself. The ID can change if other objects are deleted from the form so it is best to use the name you have given the object even if you know the current ID.

If you’re looking to write a generic procedure, that you can use on whichever form is currently active, your best approach would probably be to use the formblueprint statement to put the form’s blueprint in a variable. You could then use the tagdata( and tagarray( functions to extract whatever properties you are looking for.

Another touch if it’s generic, but depends on how your procedure is triggered, is to use SetTrigger in the Procedure panel of your trigger. There you can enter the name of the object you want to adjust.

SetTrigger “BigObject”
Call …

Good one, Dave. That looks like a solution. I’ll have to study that in some more detail, but it’s a logical route to follow.

I know NOTHING of the blueprint feature (it doesn’t exist in Pan6). So I will have to re-enter “learning mode”.

Thanks to all who contributed/

Vic

If you want to see what a blueprint looks like, put a form into graphics mode, click on Blueprint, and select Entire form…

Hi Dave,

Actually, I already found that feature. But, the blueprint form does not identify or describe the graphics already on the form. And so it doesn’t give the unique ID of the graphic.

I’m beginning to think PanX does not have a way to generically access a property of a form’s graphics. An object’s property can only be accessed with the ID, which can’t be accessed without the ID, which can’t be …etc
I can’t see how anyone can use the OBJECTINFO

I can’t see what the objectinfo function can ever accomplish in a procedure. You have to first know the ID (or the name) of the object to use the function. But how would you know that at the start of the macro?

If you click on an object on a form in data mode and then run this procedure it will give you the procedure text of the object clicked.

message objectinfo("procedure", info("clickedobjectid"))

You can obviously get all the other values of the object using this scheme as well.

Yes it does. The blueprint contains the code that Panorama used to build that form, and populate it with objects. Those objects can’t exist, unless they are described in the blueprint.

There is no procedures property associated with the objectinfo( function, only procedure (singular). I think, however, that you may be providing a clue as to what you are actually trying to do. Do you want to find out the code associated with ALL the objects in your form? If that is what you want to do, you’ll need to use the objectinfoarray( function.

Everyone above trying to help you is handicapped by the fact that you haven’t actually told us why you want to access the procedure code. I think you need to tell us that if you want useful assistance.

That’s completely incorrect.

Also, by the way, you would never want to put an object ID number into your code, because those numbers aren’t permanent. You can find out an object ID with objectinfoarray( or info(“clickedobjectid”), but then you should only use that ID immediately and then throw it away.

If you want to permanently reference a particular object, you should give it a name and reference it by name. But it sounds like that isn’t what you want to do.

Dave, I must be doing something really wrong.

When I enter graphics mode and call up “Entire Blueprint”, the image below appears. This particular form has only one graphic (it’s a button), but it DOES have an associated procedure. But the blueprint window below is different from the image you show above. My window doesn’t have a “procedures” entry.

Oh well. It’s the weekend. Maybe inspiration will come with a glass of wine.

PanX and I just don’t get along as well as I had hoped.

Vic

No, but if you scroll down, you will find a “PROCEDURE” entry.

Note, however, that the blueprint isn’t really going to help you. Yes, you could find out what the current ID of the object is, but you don’t want to use that number, since it may change when the form is edited.

Yep. There it is. You’d think this is the first time I used a computer.

Jim, you know what would be a good idea? A new function that would create a text array of all the IDs on a form. PanX must have some sort of internal register with this information - how else would the onjectinfo functions work? Would this function be difficult to make?

With such a function, one could load the ID text array into a variable, and with subsequent ARRAYFILTER commands, create arrays with information about all the forms objects, using as the ID parameter the associated element from the ID array. Names, class, color, etc, would be available for all objects. And the beauty is that if an ID changes, for whatever reason, it would not affect the other arrays. Everything will still give the same result, because the ID array will automatically adjust. One doesn’t need to “know” what the ID is. You only need the ID in a list.

Maybe this is not something that most users want. Anyway, I propose it for your consideration.

Regards,
Vic

The objectinfoarray( function Jim mentioned can return that array.

objectinfoarray(|||objectinfo("id")|||)

It will likely make that list of IDs unecessary though.

objectinfoarray(|||objectinfo("procedure")|||,"",lf()+"**********"+lf())

That would list all the procedures, separated by rows of asterisks.

Dave, You’re something!

Vic

Expanding on Dave’s suggestion, you could use code like this with the desired form to generate a nice list of object ID’s, object class type and any procedure code in the object.

fileglobal formBlueprint
formBlueprint=objectinfoarray({objectinfo("ID")+": "+objectinfo("class")+
    sandwich(cr()+"•••"+cr(),objectinfo("procedure"),cr()+"•••")})
displaydata formBlueprint

Here is a sample when I ran it on one of my forms:

More specifically, he’s someone who reads the help text.

1 Like

Hello Gary,

I plan to cycle through all forms in the database by looping through the dbinfo “Forms” array. In fact, an earlier outer loop is looping through many databases.

How does your code know which form to apply to? What makes a given form the active or selected form for your code?

I hope my questions don’t appear too trivial to forum members. I really do try to figure these things out myself, but am not always successful. And I do consult the Help text.

Vic

Here is some code that will get a list of all the forms in the current database and loop through them extracting the info on the object ID, class type and any attached procedures.


letfileglobal formList= dbinfo("forms","")
letfileglobal allGraphicProcedures=""
letfileglobal formBlueprint=""
looparray formList,cr(),element,index
    goform element
    formBlueprint=element+cr()+objectinfoarray({objectinfo("ID")+": "+objectinfo("class")+
        sandwich(cr()+"««««"+cr(),objectinfo("procedure"),cr()+"««««")})
    allGraphicProcedures=allGraphicProcedures+cr()+cr()+"••••••••••••••••••"+
    cr()+cr()+ formBlueprint
endloop
displaydata allGraphicProcedures

goform

Of course. Thanks, Gary.

I’m clearly not as sharp as I was many years ago when I was only age 75.

Vic