New topic: 

AddHandler, Events

<http://forums.realsoftware.com/viewtopic.php?t=45734>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        hpstocker          Post subject: AddHandler, EventsPosted: Sat 
Oct 27, 2012 5:39 am                         
Joined: Tue Feb 17, 2009 5:25 am
Posts: 12                I made a custom class supclassed from TextField and I 
need to use AddHandler.

It works fine for events that do not return a value, e.g MouseMove.
But I can't handle events returning a value, e.g MouseDown which returns a 
Boolean.

That's my setup:
I have a window with a ListBox on it, call it 'myWindow' and the ListBox 'LBox'
I have a new class 'PopUpTextField' subclassed from TextField
In the Open event of that class I have following code:

Sub Open
Dim popWindow as myWindow
popWindow = new myWindow
AddHandler popWindow.LBox.MouesDown, AddressOf mEventMouseDown
... (more code)
popWindow.Show
End Sub

Function mEventMouseDown(sender As ListBox, x As Integer, y As Integer) As 
Boolean
beep
... (more code)
End Function

It is compiling and running but I never get the beep.

If I change that to the MouseMove event it is working!

Sub Open
Dim popWindow as myWindow
popWindow = new myWindow
AddHandler popWindow.LBox.MouesMove, AddressOf mEventMouseMove
... (more code)
popWindow.Show
End Sub

Sub mEventMouseMove(sender As ListBox, x As Integer, y As Integer)
beep
... (more code)
End Sub

Here I get the beep when I move the mouse over the ListBox in the open window 
'myWindow'
What do I miss?
It has somthing to do with the return value of the event but I can't see the 
point.

thank's for any advice
Hp Stocker, RB 2012 v1.1 on a Mac   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to