Results 1 to 4 of 4

Thread: for each control with custome control

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    for each control with custome control

    hi,
    i have built a simpel custom contol it have some radio button and checkboxes also some properties like upoints etc..
    then i paste it to my form. then i built 12 instatnces of this control thru codes at runtime...
    for i = 2 to 12
    dim ucnt as new myuc1
    ucnt.name="myuc"+tostring(i)
    'set the positions and show it
    next
    works fine
    whenever user click on checkbox or radio buttons the upoints has changed
    now how i get the 12 controls point property at run time thru codes
    i wrote this
    dim cnt as control
    for each cnt in mypanel.controls
    if instr(cnt.name,"myuc") > 0 then
    msgbox(cnt.upoints) <<<<< give error here by compiler bcoz upoints is not define...
    end if
    plz help me

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: for each control with custome control

    Well, can't say I have ever heard of something called upoints. Is that a property of a control that I have just always overlooked, or is that a custom property of your custom control? It seems that the possible answer would be different for different answers to that.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: for each control with custome control

    yes it's a custom property
    you tell me plz if we made some controls at runtime eg..
    how to get it properties.

    or if i made controls at desin time then how to set it position at runtime
    i paste my custome control 12 time in a place holder
    and set it property at run time
    eg
    mycus2.top=12
    mycus2.left=0

    and so on...
    now it's overlap each other...

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: for each control with custome control

    Setting the top and left properties at runtime is certainly how I'd do it....except that I guess I put all controls on a panel, and only move the panel around. However, when I move the panels around, I do so by altering the top and left properties, so that should work equally well for you.

    You say they overlap. Do they only overlap a little bit, or are they all right on top of each other. If they overlap only a little bit, I would guess that the units you are setting for top and left are not what you think they are. I'm not sure which units are used for mobile dev, but it may be pixels.

    As for the error in the original question, you define a control, then try to access the custom property that you have given it. However, you defined cnt as a member of Class Control. Your custom property is not a member of Control, it is a member ONLY of the custom class that you created. It may be derived from control, but the base has no knowledge of a property unique to the derived class.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width