Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get fully qualified object name from object reference?
Message
From
07/01/2009 14:26:51
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01371824
Message ID:
01371838
Views:
19
Oops..

That is returning it with the root being the form name, and for some reason THAT is failing when used in a EVALUATE call.

It returns
"formquote.pageframe1.pageMtlSummary.grid1"

but, when I pass that through Evalulate("formquote.pageframe1.pageMtlSummary.grid1"), it does not resolve it. It says "object formquote is not found."

If the root is ThisForm it does work, but that is not what the sys() method returns.

If I pass "thisform.pageframe1.pageMtlSummary.grid1" into Eval, it works fine.

I tried '_screen.'+sys(1272,loGrid) and '_vfp.'+sys(1272,loGrid)' but that did not work either.

The GridExtra.Setup() does an eval on GridExtra.GridExpression, and that is where it fails.
It seems to want 'thisform.PageFrame1.PageMtlSummary.Grid1', which I previously was hard-coding, not 'formquote.pageframe1.pageMtlSummary.grid1'. You can see that I am trying to refactor the grid reference to one place at the top of the code.




Here is the code from the Activate() event on the Page:
Local lcAlias

 Dodefault()

 lcAlias='csrSummaryMtl'
 loGrid=this.oLineItemsGrid

 *-- Do we need to fetch the rocords, or do we already have them?
 If thisform.lMtlSummaryCursorReady=.f.
  *-- Clear grid, get data, setup grid ---
  loGrid.RecordSource=''
  thisform.getSummaryMtlRecords(QuoteInf.quote_no, lcAlias)
  loGrid.RecordSource=lcAlias
  loGrid.set_header_captions()
  loGrid.AutoFit()
  thisform.lMtlSummaryCursorReady=.t.

  *-- Setup GridExtra to work with grid above ----------
  Iif(PemStatus(this, 'GridExtra', 5), this.RemoveObject('GridExtra'), null)
  loGridExtra=this.AddObject('GridExtra', 'GridExtra')
  this.GridExtra.GridExpression=Sys(1272,loGrid)
  this.GridExtra.setup()
 endif
 
 thisform.calcSummaryMtl(lcAlias) && Recalculate in case a filter has been set on the records.

 thisform.Refresh()
>>How can I get the fully qualified object name from reference to the object?
>>
>>For instance a Grid on a Page in a PageFrame on a Form...
>>
>>So in a method on the Grid, I can just use 'this.', but this full object heirachy is ''thisform.pageframe1.pageMtlSummary.grid1'
>>
>>How can I resolve the full path name from just the object reference?
>
>sys(1272)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform