cancel
Showing results for 
Search instead for 
Did you mean: 

What control has focus

Former Member
0 Kudos

Hi. I created an object (uo) and want to close when it loses the focus, as I can know that object has the focus?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I created an object with two DataWindow Control (dw_filter and dw_detail) and a picture object.

I have a function to resize the object (of_resize) that is invoked from the event ue_mousemove picture object. There are two points on which I need help.

1. The object disappears when resizing.

2. I also resize the columns of the DataWindow Control

Former Member
0 Kudos

Hi Jorge;

For Q#1 - do you mean .... "Only the Picture"?

For Q#2 - do you mean .... "it works but I have an issue"?

                                        "I do not know how to do that"?

                  

Regards ... Chris

Former Member
0 Kudos

Hi, I resolved to point 1. In my function of_resize

Place:

At start:

iw_parent.SetRedraw(False)

This.SetRedraw(False)

At end

This.SetRedraw(True)

iw_parent.SetRedraw(True)

Former Member
0 Kudos

Chris, Not how to make resize columns datawindow.

Former Member
0 Kudos

Hi Jorge;

  For the objects (like columns) in the DataWindow object you will have to keep in mind that your coding on the DW Control which is two child levels (minimal) away from itself. So the relationship would be:  DC=> DWO => Column.

  You can accomplish the manipulation of any object within the DW Object via either a Modify ( ) method call or using what PB calls DOT Notation. So for example, here is how I would change a columns width & height using both approaches ...

DC.Modify ("<Columnname>.Height = '150' ")

DC.Modify ("<Columnname>.Width = '5000' ")

   - or in DOT notation -

DC.Object.<Columnname>.Height = '150'

DC.Object.<Columnname>.Width = '5000'

Tip: Use the DW Syntax utility to help build your PowerScript commands you need for any DW & its child object's manipulation! 

HTH

Regards ... Chris

Former Member
0 Kudos

Chris, Very good!

Thanks.

Former Member
0 Kudos

No problem ...  Good luck!

BTW:  If your have questions are solved, please mark your question as answered.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi, I solved with this code:

GraphicObject which_control

which_control = GetFocus() //Identificar el control que tiene el foco

IF isvalid(which_control) THEN

  IF which_control <> This THEN

  CloseUserObject(This)

  END IF

END IF

Former Member
0 Kudos

Hi Jorge;

I am not sure that you can reply on what THIS is pointing to - depending on what object & event you placed the above code on.

  Another way to code that would be on the UO's LooseFocus event ... 

THIS.Post CloseUserObject ( This )

  -  OR -

1) Create an instance variable:  <Your UO>  io_user

2) On the OpenUserObject ( ) command - use Type2 syntax...

    OpenUserObject ( io_user, targetobjecttype {, x, y } )

3) On the UO's LooseFocus event ...

   IF IsValid (io_user) = TRUE THEN

       CloseUserObject (io_user)

   END IF

HTH

Regards ... Chris

PS: If you are going to continue with your code .. I would add the following check:

  IF  Which_Control.TypeOf ( ) = UserObject!  THEN

     .....

  END IF

Former Member
0 Kudos

Hi Chris;

I created a ue_checkfocus event. I have this code:

GraphicObject which_control

PowerObject   which_Parent

which_control = GetFocus() //Identificar el control que tiene el foco

IF isvalid(which_control) THEN

  which_Parent = which_control.GetParent()

  IF which_Parent <> THIS THEN

      CloseUserObject(This)

  END IF

END IF