Log In    |    Knowledge Base    |    4D Home
Tech Tip: IDs and components
Published On: February 5, 2004

Compatibility: Version 6.8.x and 2003.x

If you are writing a component that uses resources, you need to be aware that you may not be the only one doing so. Resource IDs start from 15000. Many developers use this value. 4D will not allow components to use the same range. So when you install two or more components that use resources, and some of them share the same range, 4D is going to renumber these resources internally.

This means that your component also needs to reflect that change and that you will need to use this new range instead of a hard-coded one.

This is when you can use the Get component resource ID command. You will need to provide the component's name, the type of resource and the original resource ID. The command will return the current resource ID.

For example, in our component example named "MycomponentA", the code below is supposed to return 3 elements in the at_Array variable.

vResNumb := 15000
STRING LIST TO ARRAY(vResNumb; at_Array)

After installing another component, named "MycomponentB", that also contains an STR#15000, our code could return different values, values of the STR#15000 from the newest component. The following code will help you to retrieve the connect results

vResNumb :=Get component resource ID ("MycomponentA";"STR#";15000)
STRING LIST TO ARRAY(vResNumb; at_Array)