Author Topic: [Solved] Is changing name supposed to make a control nil?  (Read 2828 times)

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1283
    • Lebeau Software
Re: Is changing name supposed to make a control nil?
« Reply #15 on: June 12, 2023, 06:29:01 pm »
Unfortunately your idea will not work for me because when I reference controls by control index it gives me the original checkbox put on frame at design time instead of the alias..  :(

Makes sense, because changing a control's Name at runtime does not destroy and recreate the control, and doesn't have any effect on the order of controls.

I guess creating at runtime is only way?

The real question is - WHY are you renaming controls at runtime which are created at design-time?  What are you actually using the names for?  If you need references to controls that are not affected by changing their design-time names at runtime, then you need to maintain your own references at runtime.

Another problem I’m having is I can’t seem to make the checkbox the first control on the frame at runtime, {another control was placed on frame at design time.} The setcontrolindex (checkbox,0) does not make it the first element in controls array. Am I doing something wrong?

Can you show your actual code?

I guess the control index of the one placed at design time cannot be changed either?

I don't see why not.  Design-time objects are still created at runtime.  Once they are created, you can do whatever you want with them. SetControlIndex()/SetChildZPosition() does not do anything special with controls created at design-time vs at runtime.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)


TinyPortal © 2005-2018