General information
Category:
Coding, syntax & commands
>>Hi Alex,
>>
>>Thanks for your suggestions. In fact, the code I presented was just a sample. It's not a complete code. The reason for using the Hide() is that I can reuse the object to display another progress bar (without recreating it). Typically, the progress bar object is created as a public variable at the start of the application, and this variable is released when the application terminates.
>>
>>- Ravi
>
>Hi Ravi,
>
>Interesting idea about hiding progress bar rather than instantiating again. I'll try to remember it though I didn't notice any delay...
I used the same approach (global object always available), but I did give it up as it brings some side effects as:
- the object is a form that contains the progress bar, and you have to take extra care to hide this form from your form manager, meaning that you have to make exceptions (which I dont like). You can overcome this by managing only certain clases of forms, but again it implies more coding and complexity just for a progress bar.
- sometimes, and in some circumstances the form did not hide well and it interferes with the rest of the interface. It happened only in certain machines and I could not isolate the problem, so perhaps it was not my fault and you might end up getting this undesired behavior.
- there is not really any noticiable performance penalty in instantiating your progress bar form everytime you need it (I haven't measure it, but I don't think it takes more than 1/100 of a second). And you have to code only two lines more than when you have a global variable (one line for creating the object, one line more to explicitly destroy it).
- I like to avoid as much global variables as possible.
Just my .02,
Javier.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only