1. Tom Mangano
  2. PowerBuilder
  3. Monday, 20 September 2021 22:12 PM UTC

my window that was originally programmed in PB4 and converted to tabs when they became available (PB7 maybe) has grown over the last 20 + years

it has approx 50 tab page objects, some with tabs on the tabs, 100 + datawindows, more buttons and a more bad programming than i'd like to admit to.

i need a way to do 2 things. 

first, loop through all of the controls on the dw, if it's a tabpage, get its name.

if it's a tabpage, get the names of the button objects on it.

i have a loop 

for ll_lp = 1 to arg_window.Control[]

lwindow_object = arg_window.Control[xloop].TypeOF()  <<< this tells me the type of object, how do i get it's name

ls_tab[ upperBound( ls_tab ) + 1 ] = ???? name of tab control

...  more programming

next

Thanks for any help

Tom M

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 21 September 2021 00:11 AM UTC
  2. PowerBuilder
  3. # 1

Hi Tom;

  Use the ClassName() method for that right after the TypeOf ().

Regards ... Chris

Comment
There are no comments made yet.
Tom Mangano Accepted Answer Pending Moderation
  1. Tuesday, 21 September 2021 15:45 PM UTC
  2. PowerBuilder
  3. # 2

here's what i did with the 2 suggestions from Chris and Arnd.  i haven't debugged to see if it's going to give me what i need.

added this

ClasssDefinition   lcd_control

for ll_lp = 1 to arg_window.Control[]

lwindow_object = arg_window.Control[xloop].TypeOF()  <<< this tells me the type of object, how do i get it's name

if lwindow_object=Tab! then

      lcd_control = arg_window.Control[ ll_loopCounter ].ClassDefinition

      ls_tab_name = lcd_control.ClassName()

ls_tab[ upperBound( ls_tab ) + 1 ] = ls_tab_name

...  more programming

next

thanks Chris and Arnd

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 21 September 2021 18:40 PM UTC
You are most welcome Tom!
  1. Helpful
There are no comments made yet.
Arnd Schmidt Accepted Answer Pending Moderation
  1. Tuesday, 21 September 2021 00:01 AM UTC
  2. PowerBuilder
  3. # 3

Take a look at

Classdefinition lcd_control
lcd_control = arg_window.Control[xloop].Classdefinition

hth

Arnd

Comment
There are no comments made yet.
Tom Mangano Accepted Answer Pending Moderation
  1. Wednesday, 22 September 2021 21:29 PM UTC
  2. PowerBuilder
  3. # 4

i tried the suggestions from Chris and Arnd, still don't get what i want

here's the programming

    ll_object_count = UPPERBOUND( w_customer_tab.Control[] )

    for ll_loopCounter = 1 to ll_object_count
        
        window_obj_type = w_customer_tab.Control[ ll_loopCounter ].TypeOF()
        
        CHOOSE CASE window_obj_type
                
            Case Tab!
                
                lcd_control = w_customer_tab.Control[ ll_loopCounter ].ClassDefinition
                
                ls_tab_name = lcd_control.ClassName()            // didn't give me tab_1
                ls_tab_name = String( lcd_control.ClassName() )    // neither did this
                
                ll_temp = UpperBound( as_tab[] ) + 1

                as_tab[ ll_temp ] = ls_tab_name
                    
            Case Else
            
        END CHOOSE
        
    next

i was expecting to see tab_1 in ls_tab_name, ls_tab_name = "classdefinition"

am i calling functions in the correct order?


here's a screen shot from the debugger

  

 

 

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 23 September 2021 13:13 PM UTC
Change ... "ls_tab_name = lcd_control.ClassName() " to ...

"ls_tab_name = window_obj_type.ClassName() "
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 22 September 2021 21:54 PM UTC
  2. PowerBuilder
  3. # 5

Hi, Tom - 

Try the Name property of each object. This is what you have highlighted in the image you posted.

The ClassName() function returns the name of the object's class, not the name of the object instance. 

HTH, John

Comment
There are no comments made yet.
Arnd Schmidt Accepted Answer Pending Moderation
  1. Thursday, 23 September 2021 08:36 AM UTC
  2. PowerBuilder
  3. # 6

Take a look at Classdefinition object and how to use it.

Classname () is nearly useless in that scope.

In the Classdefinition you find for example
Name,
LibraryName,
and a reference to the classdefintition of the ancestor, including the Name and Libraryname of the ancestor.

Furthermore you can iterate over the NestedClassList[ ] in the classdefinition.

Keep in mind that the control[] array during runtime is a dynamic property and that the nested class list in the classdefinition is a static array.

hth

Arnd

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 23 September 2021 13:29 PM UTC
  2. PowerBuilder
  3. # 7

Hi Tom;

   FWIW:  The ClassName() command is all you need. You do not need ClassDefinition ...

:-)

Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.