[Gambas-user] Gambas custom controls : renaming the exported class

Benoît Minisini gambas at ...1...
Thu Jun 23 09:12:51 CEST 2016


Le 23/06/2016 05:04, adamnt42 at ...626... a écrit :
> Well this is a bit obscure but for me it's a big pain.
>
> When developing a custom gambas control I quite often include a test
> form inside that project. That form is used extensively during
> development of the custom control (i.e. even before I package and
> deploy the control in client projects, and sometimes even later when
> issues arise...)  Now, here's the problem. If I have given the
> control a "development" name and I later want to give it a more
> meaningful name, the entire custom control project collapses because
> the renamed class does not exist in the test form.
>
> An example might illuminate.  I am working on a "lightweight" version
> of the native DirChooser control - in essence, I want to get rid of
> much of the extended functionality of the native control and just be
> able to display a directory tree, no file view, no added vitamins
> etc. So, I copied the native source and have expunged much of the
> features I do not need. The goal is to just display a directory tree
> in a side bar, so I need to get rid of the extra features and just
> show the tree. It's a bit like the IDE project tree sidebar but even
> simpler.
>
> So developmentally, I (like the fool I am) renamed the "target"
> control class as XDirChooser.  Now I want to rename that class
> "LWDirChooser" (for Light Weight) so it will appear in the IDE quite
> visibly. But having done that, the test form is now invalid and the
> component wont compile.... grrr.  To work around this I need to edit
> the test.form file and change the XDirChooser to a LWDirChooser, then
> it all works.
>
> But it is a right royal PITA!
>
> This bug is raised in the spirit of your comment at the end of the
> "How to develop Program Components in Gambas" page: Conclusion
>
> I try to find the easiest way of making components with the IDE. It
> is not perfect yet, but if you have any comment, question or problem,
> please use the mailing-list!
>

I didn't think about that. It's because I usually directly use the final 
name of the control, and so my test forms are always valid.

The problem is more general anyway, as if you rename any class in your 
project, other classes will continue to use the old name, and will fail 
at compilation or execution time.

You have to rename the class by hand everywhere, and in the forms you 
cannot do that if it was not already opened before you renamed the class.

I will try to implement an automatic renaming of form classes. It may 
slow down the renaming process, but I think I have no choice...

-- 
Benoît Minisini




More information about the User mailing list