Re: Controling Event Sequencing...




Thanks, unfortunately this does not solve my problem...another example...


the problem is ... the initial 'click event' will not be completed before
the OnPostClick event is fired / executed ... that is the problem ... i need
the OnPostClick event fire after the OnClick event is completely finished
.... I need some way to put to the OnPostClick in the windows event queue and
have it execute AFTER the OnClick in completely done ... at all levels...

Another example...

say you have a custom control...with an event ... ItemChanged ... the
control exposes this event to the programmer to allow him / her to capture
and code on it according ... however once the control fires this event - the
ItemChanged -, it continues processing the rest of 'its' system events to
complete the ItemChanged action ... say some internal stuff ... writes data
to a buffer / file and so on ... These events will happen right after the
programmer exposed Itemchanged, as the control has already put them in the
windows event queue - ItemChanged for the Programmer, ItemChanged Write to
File (control event not exposed), ItemChanged write to Buffer (control event
not exposed) and so on ... So, these system / control events will
immidiately fire after the programmer's - ItemChanged event ...

So, what I want to be able to do, is create a base class object for this
control ... myControl...

in the ItemChanged event I want to call / raise my own user event ...
ueMyEvent_AfterChange ... the purpose is so I know when the entire
ItemChanged event is completed and the data has been writen to the file ...
or a buffer...or whereever...my event will be next...so, using the event
sequence from above...ItemChanged for Programmer, ItemChanged Write to File
(control event), ItemChanged write to buffer (control event), and now my
ueMyEvent_AfterChange fires.

Now, in my application, whenever I need this control or versions of
(descendants) ... I can use my custom event ueMyEventChanged to access the
information in the File / Buffer... because I know the control's entire
ItemChanged event has completed and MyEventChanged will not fire until it is
completely done. Simply calling the event inside the Itemchanged event will
not give me what I want ... I need someway to tell vb to delay my custom
event until the control's ItemChanged event or or System OnClick of the
button is completed and run it course ...

Does this make since...or sound a little stretched...

Jeff.

"Claes Bergefall" <louplou@xxxxxxxxxxxxx> wrote in message
news:eECBaCgmGHA.4992@xxxxxxxxxxxxxxxxxxxxxxx
Define when an event has completed (and when it begins).

The simplest solution is to do this:
Protected Overrides Sub OnClick(...)
OnPreClick(...)
MyBase.OnClick(...)
OnPostClick(...)
End Sub

Not sure if this meet your definition of completed though

/claes

"jeff" <jhersey at allnorth dottt com> wrote in message
news:OTVHSjVmGHA.2452@xxxxxxxxxxxxxxxxxxxxxxx
in addition....

I want to post the raise the event so that it will execuate after the
current system event has completed...

Jeff.

"jeff" <jhersey at allnorth dottt com> wrote in message
news:e68VpZVmGHA.4816@xxxxxxxxxxxxxxxxxxxxxxx
New VB user...developer...

Situation...simplified...

- I want to wrap a pre and post event around a system generated where
the pre-event will always execute before the system event and the post
event will always execuate after the system is completed...
- I want to wrap this functionality in a framework, so I could possibly
have 3 or 4 levels of inherited objects that need to have these pre /
post events executed before and after the system event is starting and
completed...
- basically, i want to be able to add a 'Post' event to the message
queue and have it executed after the system event is completed...

ie. button clicked ... post my event ... button done clicking, system
does what is does on a completed clicked ... my event that i posted runs
now...

Example...simplified...

- I want to build to custom class inherited from the common command
button.

- I want to add a 'pre-click' and a 'post-click' event to the buttons
click event ... and still allow the developer to use the clicked
event...

so ... on my base class object ...
I add to custom subs/functions/events...whatever you want to call them
to the control...
ue_PreClick()
ue_PostClick() ...

in the click event i call them by....Click Event...
ue_preClick(...) ... calls the User Event - Pre-Click for the button...
POST ue_postClick() ... posts a User Event - Post-Click that will be
executed after the click event is completed...

Now, the sequence of events I am looking for is....

in any descendant class...if I code the pre-click event....the code will
execute before the click and postclick events...simple, this works.

now, in any descendant class...i want the post-click event to fire only
when the Click event is completed for the button...

So, for example...

ButtonBaseClass...base object inherited from the windows controls
buttons ...

Add two functions...

uePreClick (arg...)
uePostClick(arg...)

Now, I inherit from this and create another button...

ButtonFirstChild

I place this code the the uePreClick

MessageBox.Show("Hello, I am in the PreClick Event")

I place this code in the uePostClick event ...
Messagebox.Show("Hello, I am in the PostClick Event")

and finalling, I put this code in the Clicked Event...system event...
Messagebox.show("Hello, I am in the Clicked Event")

So, when I click the button ... I want to see message boxes ...

PreClick...
Click...click is done...
PostClick...

So, my question is, is there anyway in the ancestor / parent / base
class to code it such that is will execute the events in this order ...
I know I could code three custom events .... uePreClick , ueClick, and
uePostClick ... and code accordingly, but what I am after here is I want
the uePostClick event to fire after the system Click event has
completed...

Is this possible in VB .Net....this is a technique I user with
Powerbuilder and it works just fine...unfortunately, I can see not how
to handle this is VB...and help of guidance would be great...

the Application.DoEvent will flush the message queue but it will not
complete the current event before calling the 'POSTED' event...what I
need is the current event to be done ... than the post event fired.

Any help would be greatly appreciated...

Thanks
Jeff







.