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

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to