dop2000 Thanks for your reply.
Now, I have moved the local variables to global and corrected the typo. Still it doesn't work.
To help you understand the code
ButtonNameDisplayX is to record the 'X' position of the last button
ButtonNameDisplayY is to record the 'Y' position of the last button
ButtonNameDisplayLoop is to calculate the number of times the function is called
In first instance
-> ButtonNameDisplayLoop will be zero and it enables the hidden button (the first button is not created, it is already present on the screen, it is just made visible).
-> ButtonNameDisplayX records the 'X' position of the button
In second instance (when second name is added)
-> Button should be created at ButtonNameDisplayX + 72 and ButtonNameDisplayY position but it doesn't happen