Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Hi, "IDLmastertobe" <shi_lee@hotmail.com> wrote in message news:a6f3fee6b8f98956d9d1912f01028d97@localhost.talkaboutpro gramming.com... > Hi, I am dealing with IDLgrView object named oView, oView holds a lot of > other objects. I am trying to get access to those objects by using > oView->GetByName function as follows: > > oView -> GetByName, oTop=oTop > oTop -> GetByName, oGroup = oGroup > oGroup->GetByName, oBox = oBox > oBox -> SetProperty, thick=3 > > oTop was added to oView and oGroup was added to oTop, maybe the chain > GetByName structure is not necessary, but i received an error message: > > "Attempt to call undefined method: 'IDLGRVIEW::GETBYNAME'." > > why is GetByName not defined in IDLgrView oView? > > Does anyone know why? Thanks for your time. It's defined, but it's a function, not a procedure, requiring a string to match some object's Name property. If your oTop object was created with Name='oTop' (and other objects named similarly), you could then do this: oTop = oView -> GetByName('oTop') oGroup = oTop -> GetByName('oGroup') oBox = oGroup -> GetByName('oBox') oBox -> SetProperty, thick=3 Online help on IDLgrView::GetByName is helpful here. Cheers, -- -Dick Dick Jackson / dick@d-jackson.com D-Jackson Software Consulting / http://www.d-jackson.com Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
IDLmastertobe wrote: > Hi, I am dealing with IDLgrView object named oView, oView holds a lot of > other objects. I am trying to get access to those objects by using > oView->GetByName function as follows: > > oView -> GetByName, oTop=oTop > oTop -> GetByName, oGroup = oGroup > oGroup->GetByName, oBox = oBox > oBox -> SetProperty, thick=3 > > oTop was added to oView and oGroup was added to oTop, maybe the chain > GetByName structure is not necessary, but i received an error message: > > "Attempt to call undefined method: 'IDLGRVIEW::GETBYNAME'." > > why is GetByName not defined in IDLgrView oView? > > Does anyone know why? Thanks for your time. Well, all objects of the IDLgrView class and its subclasses should have a GetByName method (since version 5.0, the first version in which Object Graphcis appeared). But the problem may be that you aren't calling it right. It takes no keyword arguments, only a single positional argument which should be a scalar string. Here is how you might use it IDL> oview = obj_new('IDLgrView') IDL> otop = obj_new('IDLgrModel', NAME='top') IDL> oview->Add, otop IDL> ogroup = obj_new('IDLgrModel', NAME='group') IDL> otop->Add, ogroup IDL> obox = obj_new('IDLgrPolygon', NAME='box') IDL> ogroup->Add, obox (I'm just guessing about the object types.) Then, later, when you've lost the references to the contained objects IDL> otop = oview->GetByName('top') IDL> ogroup = oview->GetByName('top/group') IDL> obox = oview->GetByName('top/group/box') IDL> print, otop, ogroup, obox <ObjHeapVar10009(IDLGRMODEL)><ObjHeapVar10011(IDLGRMODEL)><ObjHeapVar10013(IDLGRPOLYGON) > -- Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou" m.hadfield@niwa.co.nz National Institute for Water and Atmospheric Research (NIWA)
Mark Hadfield in New Zealand wrote: > IDL> otop = oview->GetByName('top') > IDL> ogroup = oview->GetByName('top/group') > IDL> obox = oview->GetByName('top/group/box') Dick Jackson in Canada wrote: > oTop = oView -> GetByName('oTop') > oGroup = oTop -> GetByName('oGroup') > oBox = oGroup -> GetByName('oBox') You'll note that both of these work fine, your choice of approach may depend on which side of the world you're on. :-) Cheers, -- -Dick Dick Jackson / dick@d-jackson.com D-Jackson Software Consulting / http://www.d-jackson.com Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
thank you very much for your help. I appreciate your time.