[Gambas-user] Benoit, How to bypass a super event

Bruce bbruen at ...2308...
Fri Feb 7 12:28:19 CET 2014


On Fri, 2014-02-07 at 11:37 +0100, Fabien Bodard wrote:
> For example i have a class that emit an event
> 
> MyClass1
>   Event data
> 
> 
> MyClass1   -> so over drive the native class 1
>   Event Data
> 
>   Public sub Super_Data()  -> this is what i want to do
>     inc    _Index
>     raise Data
>   end
> 
> 
> 
> For the user it's transparnt as it is alway the class MyClass1 that
> emit the data event... but the sur-layer can catch the event before
> the emit.
> 
> 
> well to say trust i'm trying to add the multipage on printer
> 
> 
> so basically if i say 4 page on one i need to give to painter 4 time an image
> 
> 
> 
> Public sub Super_Begin
> 
> Raise Begin
> iOldCount = Super.Count
> 
> end
> 
> Public sub Super_Draw()
> paint.scale(1/iPageByPage,1/iPageByPage)
> For i = 0 to iPageByPage
>   Paint.Begin($aImgPage[i])
> 
>     raise Draw
> 
>   paint.end
> next
> paint.reset
> 
> for i = 0 to iPageByPage
> 
> Draw.Image(...
> 
> next
> 
> 
> 
> end
> 
> Public sub Super_End
> 
> raise End
> Super.Count = iOldCount
> end
> 
> 
> Well it is just a concept code ... it don't work. But printing
> multipage on gambas don't need necessary to implement this on each
> toolkit but just via a gambas class.
> 
Not quite here with you yet Fabien.

I have done (I think) this many times.  I think respond to the event in
the intermediate class.  (Oh and its a good idea to have an observer
hanging around somewhere!)  

Mainly I needed to trap the Change and Activate and LostFocus events in
a custom control that included, say, a textbox. So all three events are
trapped in "InnerTextBox_<some_event>(blah blah).  From which I then
raise a differently named event for the custom control (usually
"Changed") So if I read you correctly, the first thing I'd try is to
rename the raised event "data" to something like, eh, "neudata". That at
least might let you see who is bugging who :-)

(As a matter of fact I have been chasing down a similar, but not the
same, beast today too.)

cheers
Bruce
 






More information about the User mailing list