Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Full names of objects

Status
Not open for further replies.

alvechurchdata

Programmer
Nov 8, 2003
1,737
GB
I need to generate a table holding the full names of all the controls on all the forms in an app. By full names I mean something like:
[TT]
...
frmOrder.pgfOrders.pagDetails.grdDetails.colType
frmOrder.pgfOrders.pagDetails.grdDetails.colType.hdrType
frmOrder.pgfOrders.pagDetails.grdDetails.colType.opgType
frmOrder.pgfOrders.pagDetails.grdDetails.colType.opgType.optAir
frmOrder.pgfOrders.pagDetails.grdDetails.colType.opgType.optSea
...
[/TT]
I thought it would be a straightforward case of working through the objName and parent fields of the myForm.scx table recursively but it's more difficult than it seems.

I can get the simple controls but some containers are a problem. An example, Option Buttons aren't listed as separate records in myForm.scx; their details are inside the Properties field of their Option Group. Like this:
Code:
ButtonCount = 2
Value = 1
Height = 46
Left = 59
Top = 20
Width = 71
Name = "Optiongroup1"
optAir.Caption = "Air"
optAir.Value = 1
optAir.Height = 17
optAir.Left = 5
optAir.Top = 5
optAir.Width = 61
optAir.Name = "optAir"
optSea.Caption = "Sea"
optSea.Height = 17
optSea.Left = 5
optSea.Top = 24
optSea.Width = 61
optSea.Name = "optSea"
The same applies to other collections like columns in a grid and pages in a pageframe. The columns of a grid are listed in the properties field but headers and text boxes exist as individual entries in the table.

It's messy so before I settle down to write the code, can anyone suggest an easier way of getting the list that I need?

Geoff Franklin
 
Why exactly would you need such a thing?

Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Check SYS(1272,oObject) in HELP.

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
 
If you have FoxPro Advisor, check out my article in the August, 2005 issue. I needed to do the same thing for the Builder described there.

Tamar
 
Thanks bborissov. If I put this:
Code:
FOR EACH cnt IN thisform.Controls
  DEBUGOUT SYS(1272, cnt)
next
in the form's Init then I get what I want.

The reason I want it is because the client's asked to be able to set time-sensitive security access right down to individual controls. Every control on every form has to go to a lookup table at runtime to determine whether it's enabled, password-protected, hidden or whatever for this user on this PC at this time of the day and on this day of the week. I'm hoping to give him his security scheme by just adding a little code to his existing base classes and populating a huge lookup table.

Geoff Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top