event, signal handling: idea

Moderator: Rathinagiri

Post Reply
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

event, signal handling: idea

Post by l3whmg » Sat Sep 03, 2011 3:10 pm

Hi friends,
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.
About b), please take a look to the relative method with SETGET (ie METHOD OnInterval); as you can see is very simple and the source code does not require special attention

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
3) As you can see I reintroduce Create method: I think this is an important method becasue every object can/must be personalized. I prefer to see within every object not as inherited method, but this is My Humble Opinion.

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.

Cheers

p.s. within this source, I change lEnabled with lStarted, because IMHO lEnabled means other with Qt. see enabled() and isEnabled()
Attachments
timer.zip
timer experiment
(2.04 KiB) Downloaded 103 times
Luigi from Italy
www.L3W.it

Post Reply