[Gambas-user] Strange ERROR if "Utility" in Name Menu

Jørn Erik Mørne epost at ...3323...
Wed Oct 1 23:18:50 CEST 2014


Den 01. okt. 2014 23:08, skrev Tobias Boege:
> On Wed, 01 Oct 2014, Ru Vuott wrote:
>> Hello,
>>
>> our friend of italian Gambas forum posted an his project, where a strange error is raised if the "Name" of Menu is "Utility"...
>>
>> Your opinion ?
>>
>> His project here attached  (look at the "Name" of "Menu5" inside !)
>>
> This is because the menu name is "Utility" and the project options say that
> "form controls are public".
>
> So what happens is: the compiler creates public variables in the form which
> have the name of the controls in the form (I guess), so that the programmer
> can write FMain.myMenu to access their menu control. But Utility is actually
> a boolean property of the Form class already from which FMain inherits, so
> the not-so-strange "incorrectly overridden" error is raised.
>
> Our friend did two things wrong here: normally, you shouldn't tick the "form
> controls are public" checkbox. Indeed the program seems to not need it at
> all. It's the same as having everything be a global variable -- it nullifies
> the principle of encapsulation.
>
> The second thing is to violate the Gambas naming conventions :-) Calling a
> thing "Utility" asks for trouble, "mnuUtility" would be fine.
>
> Regards,
> Tobi
>
Apropos Gambas naming conventions - is it written any place? I see 
people using h, $ frequently and also i, s and b for integer, string and 
boolean.Most of these are OK, but I do not fully understand where you 
normally put the $?




More information about the User mailing list