1. DIPANJAN DUTTA
  2. PowerBuilder
  3. Monday, 6 May 2019 05:22 AM UTC

Hi All

I have design a SingleLineEdit user object of using Standard visual user object, the of the object is u_textbox. And I am opening this user object [u_textbox] multiple times based on condition in another  Custom visual user-object. Now I have to process data on menu click, which entered by user in “SingleLineEdit” or u_textbox. To do that I have declared a loop to identify the control in window menu clicked event. But I am getting same name [u_textbox] for all SingleLineEdit user object. Is there any way to distinguish them? Are PowerBuilder assign any name when I open user object? Otherwise I can’t process them logically. I have share my code in below.

 

//When I open SingleLineEdit user object

u_textbox         l_textbox

u_design_base.OpenUserObject(l_textbox)

 

//At the time of processing

PowerObject     lpo_Object

Integer                         li_index

SingleLineEdit   lsle_TextBox

w_output          lw_dsign

lw_dsign = Parent.ParentWindow

 

//Run a loop with list of Control

For li_index = 1 to UpperBound(lw_dsign.uo_design.Control)

            lpo_Object = lw_dsign.uo_design.control[li_index]

              //Identify only Single Line Edit

            If lpo_Object.TypeOf() = SingleLineEdit! Then

                        lsle_TextBox = lpo_Object

                        MessageBox("ControlName", lsle_TextBox.classname( ) ) // name of all SingleLineEdit display u_textbox

                        //Processing with values

            End If

Next

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 6 May 2019 15:26 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Dipanjan;

  Since you are in full control of the UserObject's definition, I would suggest adding a string based instance variable that defines the object's name of use (ie:  is_use_name). I would then add Get/SetXxxxxx() methods for that variable. 

Then in the allocation, for example ....

u_design_base.OpenUserObject(l_textbox)

u_design_base.SetUseName ("Employee_Last_name")

 

Then in the Control array processing ...

      If lpo_Object.TypeOf() = SingleLineEdit! Then

           lsle_TextBox = lpo_Object

           IF lsle_TextBox.classname( )  = "u_textbox"  THEN

               IF  lsle_TextBox.GetUseName() = "Employee_last_name"  THEN

                   //...

 

HTH

Regards ... Chris

 

 

Comment
  1. DIPANJAN DUTTA
  2. Tuesday, 7 May 2019 06:18 AM UTC
Thanks Chris........This is very helpful ............:)
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 7 May 2019 18:34 PM UTC
I am glad that it helped ... All the best with your UO implementation! :-)
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Monday, 6 May 2019 05:31 AM UTC
  2. PowerBuilder
  3. # 1

Hi Dipanjan,

 

you have to define your own criterion to distinguish the controls. This can be an instance variable in each of the controls that you set after OpenUserObject. Or you simple use the position in the control[] array. The first userobject in the array is the first you have opened...

 

HTH,

René

Comment
  1. DIPANJAN DUTTA
  2. Monday, 6 May 2019 09:58 AM UTC
Thanks René........:)
  1. Helpful
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.