I know there are other topics where this argument is described but...
I would like to submit for your attention and opinion an "alternative" way to manage and use events.
In these days I write a lot with MrDuck and he gives me lessons, opinions and different pow.
Anyway, please take a look.
This experiment can be considered as a skeleton to apply in a lot of widgets: not everywhere, but in all most cases.
Fundamental principle: during Create method (or within New method, but it depends) we can connect, based upon the object, some predefited methods.
1) Please take a look to ZonCloseDo and ZonIntervalDo; within these methods, we can handle in the right way some aspects:
- a) about Qt: if signal is accepted or rejected. Qt like to know this.
b) we can handle block (or more blocks or internal block) in a right way.
2) To have a good handle, I have created to method: Connect and Disconnect. I'm thinking about release method where, for ever yobject, I
can write a code like this
Code: Select all
METHOD Release() ::oQtObject:close() ::Disconnect() ::oParent:ChildRemove( ::cName ) RETURN NIL
To try this, you can change your current timer.prg with this source (make a copy of it), recompile lib and try to use "samples\timer\demo_1.prg"; I don't test with all "samples\timer".
Please, try to imagine this solution applied to window.prg, textbox.prg, etc.
I repeat: in some cases not be possible to apply this method, which must necessarily be treated differently (I think about some events within Textbox, etc.)
I wait your opinion.
p.s. within this source, I change lEnabled with lStarted, because IMHO lEnabled means other with Qt. see enabled() and isEnabled()