ControlType() and library objects

Discussion in 'Bug Reports' started by agraham, Nov 21, 2007.

  1. agraham

    agraham Expert Licensed User

    I don't know if this is a wishlist item or a bug so I plumped for a bug!

    ControlType("object") returns "Other.SwrapObject" for any objects from a library. It would be nice if it returned the Class name from the library - which B4PPC already knows.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You could use object.ToString to get the class name.
     
  3. agraham

    agraham Expert Licensed User

    The problem is that this only works on objects from external libraries. If I iterate the controls returned by GetControls(""), which are a mixture of B4PPC native control and library objects it fails on the native controls. Please consider this for the next release. It is impressive that the treatment of external objects is so orthogonal with that of native controls (AddEvent, Control(), AddObject) but this is the one thing that I have found (so far :)) that I can't work round.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Here is a workaround:
    Code:
    c = "someobject"
    If ControlType(c) = "Other.SWrapObject" Then
           
    Msgbox(Control(c).ToString)
    Else
          
    Msgbox(ControlType(c))
    End If
    The object must first be created (using New).
    This will be fixed in the next version.
     
  5. agraham

    agraham Expert Licensed User

    Thank you Erel.

    I have already tried that workaround but it is not precise enough identification. I wanted to know the actual type of a control but I can work around it for time being.


    You obviously realised what I was after but of course my previous post
    Should have been "fails on the library controls"
     
Loading...