grandParent name component

35 views
Skip to first unread message

Romain Boyer

unread,
Feb 23, 2021, 10:18:07 AM2/23/21
to Sedona Framework

Hi,
I need to display grandParent name of my component.
This is my code for parent name
void PrintParentName() {   
          App app = Sys.app
        Component c = app.lookup(parent)
                           
        Str nameComp= c.name
        println(nameComp)
    }

but I don't find method for display grandParent name component.

Thanks!

Ron Bennett

unread,
Feb 23, 2021, 10:55:59 AM2/23/21
to Sedona Framework
I don't know off the top of my head but its nice to see someone active. 
If I get time before you figure it out I will try as well. I would think you could get the parent, and then get the parent id of that, then do a lookup name by id. Although there could be an easier method. 

Murat Egrikavuk

unread,
Feb 23, 2021, 11:14:28 AM2/23/21
to sedo...@googlegroups.com

I don’t have a chance to try this now, but here is an idea

 

Component prnt = app.lookup(this.parent)

Component grandParent = app.lookup(prnt.parent)

--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sedonadev/57cea12e-1b68-4bc8-b77a-1c3a7115dfc4n%40googlegroups.com.

Murat Egrikavuk

unread,
Feb 23, 2021, 11:19:19 AM2/23/21
to sedo...@googlegroups.com

See also the source of Point class in driver kit, getDevice() method as an example of navigation

 

  **

  ** Returns reference to parent device

  **

  Device getDevice()

  {

     App app = Sys.app

    for (Component c = app.lookup(parent); c != null; c = app.lookup(c.parent))

      if (c.type.is(Device.type))

        return (Device)c

    return null

Romain Boyer

unread,
Feb 23, 2021, 1:22:33 PM2/23/21
to Sedona Framework
Working fine

        App app = Sys.app
        
        Component a = app.lookup(parent)
        if (!a.name.equals( "app")){
            nameParentComp = a.name;
            println(nameParentComp);
            Component b = app.lookup(a.parent)
            
            if (!b.name.equals( "app")){
                bufConcat = concatSpace(b.name,spaceP,nameParentComp)
                println(bufConcat)
            }
        }
        else{
            return
        }

Thanks Murat

keith bradley

unread,
Feb 24, 2021, 11:46:40 AM2/24/21
to sedo...@googlegroups.com
been a while for me ... but I think you would use the same code but use grandparent name which you just obtained ?


--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages