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

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


Den 01. okt. 2014 23:29, skrev Tobias Boege:
> On Wed, 01 Oct 2014, J?rn Erik M?rne wrote:
>> 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 $?
>>
> They are here: [0]. There is a note at the end of the page which is quite
> important. The Gambas IDE is the single definitive reference if you really
> want to have an overview of all (or some) of the prefixes for graphical
> controls. I tend to forget these prefixes regularly and use slightly
> different ones (whatever sounds right). I guess nobody is expected to dive
> into the IDE to look up the correct prefix for a control :-)
>
> [0] http://gambaswiki.org/wiki/doc/naming
>

Danke mein Herr :)






More information about the User mailing list