get control parent

Discussion in 'Questions (Windows Mobile)' started by Byak@, Mar 30, 2009.

  1. Byak@

    Byak@ Active Member Licensed User

    how can i get a parent of control?
    yea?i may getcontrols() from all forms and panels and find.but it is very slow!
    i think it is real with door lib.i'm find it in msdn Control.Parent - ???????? (System.Windows.Forms)

    and try doorobj.getproperty("Parent") but it return empry string
     
  2. agraham

    agraham Expert Licensed User

    This should work with a Basic4ppc Form and Panel but not with a FormEx. It returns the internal module and control name where the "." is replaced by an underscore and is prefixed by one (IDE/legacy compiled) or two (optimised compiled) underscores.
    Code:
    obj.FromControl("Button1")
    obj.Value = obj.GetProperty(
    "Parent")
    obj.Value = obj.GetProperty(
    "propName")
     
  3. Byak@

    Byak@ Active Member Licensed User

    yes,if parent of control is FormEx it's return CSenchancedForm(((
    and getcontrols() not work with FormEx.
    Agraham maybe you add this metod to FormEx?
     
  4. agraham

    agraham Expert Licensed User

    I cannot as a library control does not know its Basic4ppc name. However every control has a Tag property for programmer use so you could set all the Panel and Forms and FormEx Tag properties to their Basic4ppc names and use that to identify the parent.

    Code:
    obj.FromControl("Form1")
       obj.SetProperty(
    "Tag""Form1")
       obj.Value = obj.GetProperty(
    "Tag")
       
    Msgbox(obj.Value)

       obj.Value = FormEx1.ControlRef
       obj.SetProperty(
    "Tag""FormEx1")
       obj.Value = obj.GetProperty(
    "Tag")
       
    Msgbox(obj.Value)
     
  5. Byak@

    Byak@ Active Member Licensed User

    big thanks agraham)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice