Kadaitcha Man ha scritto: > 2010/1/19 Doriano Blengino <doriano.bleng...@fastwebnet.it>: > > >> I think that setting up a flag won't hurt anyway, even if it is ugly. >> The whole GUI world (not only gambas) seems to have this kind of >> mentality (to raise an event in response to modifications made by code), >> > > 1) Flags are necessary in any GUI. > ?? > 2) Events caused by code should fire as if the user had performed the > function. > > Otherwise the performing code would have to emulate the control's > event sequence and there goes OO encapsulation. not to mention the > need to write unnecessary and oft-repeating code. > Debatable (but I am unwilling to debate). Is it more oft-repeating and unnecessary to write:
combo1.add('An item") combo1_click ' would be better to "raise an event to an object" (note: 2 lines of code, and only one is meaningful to our discussion) or private bUpdatingCombo as boolean ... bUpdatingCombo = true combo1.add("An item") bUpdatingCombo = false ... ' (later, in combo1_click) if bUpdatingCombo then return ... (note: 4 lines of code needed and a global variable used in three different places). And things can be more complicated than this stupid example if there is some inheritance involved - which is the order of execution of the several event handler? And should we block every event handler in the hierarchy (if it is possible) or just some? What happens behind the scenes (encapsulation!)? Regards, Doriano ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user