Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

AddEvent but no RemoveEvent??

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-19-2008, 04:13 PM
LineCutter's Avatar
Senior Member
 
Join Date: May 2007
Location: Daarsit
Posts: 161
Awards Showcase
Beta Tester 
Total Awards: 1
Question AddEvent but no RemoveEvent??

I'm probably missing something, but when I add a panel & some buttons, dispose of them all & then call the routines again I get the button_click sub called twice. Debugging shows that there is no detour between endsub & the first statement of the same sub.
Bug in B4PPC or in my programming??

Called from an imagebutton:
(Prefstable has 4 locations, one hardcoded as "All")
Code:
Sub OtherButton_ButtonDown
    AddPanel(
"Main""OtherPanel"1010 ,225255)
    spacer=
10
    ButtonHeight=(Otherpanel.Height-((PrefsTable.rowcount+
1)*spacer))/PrefsTable.rowcount
    Buttonwidth=Otherpanel.Width-(
2*spacer)
    
For i = 0 To prefstable.rowcount-1
        AddButton(
"OtherPanel", Prefstable.cell("Location",i)&"Button",spacer,((i+1)*spacer)+(i*buttonheight),ButtonWidth, ButtonHeight,Prefstable.cell("Location",i))
        
'AddEvent (Control Name, Event Name, Sub Name)
        AddEvent (Prefstable.cell("Location",i)&"Button", Click, "SetFilter")
    
Next
    Otherpanel.bringtofront
End Sub
Calls this:
Code:
Sub SetFilter
    
If Sender.text="All" Then
        jobtable.Filter(
"Done=''")
    
Else
        jobtable.Filter(
"Location='"&Sender.text&"'")
    
End If
    jobtable.SelectCell(
"index",0)
    
For i = 0 To prefstable.rowcount-1
        Control(Prefstable.cell(
"Location",i)&"Button"button).dispose
    
Next
    Otherpanel.dispose
End Sub
Which repeats twice on the second call (button click) & errors because the sender doesn't exist for the second loop through the sub. Curiously, there are only 2 loops if I opt to continue after the error.
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 04:56 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

It's a bug. See this thread http://www.basic4ppc.com/forum/bug-reports/1535-different-behavior-desktop-vs-device-addevent.html

In the last post Erel states it will be fixed it in the next major release.
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 05:09 PM
LineCutter's Avatar
Senior Member
 
Join Date: May 2007
Location: Daarsit
Posts: 161
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Thanks - I didn't mange to find that thread myself, but it makes it all clear now.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
AddEvent & ImageButton in IDE agraham Bug Reports 1 09-10-2008 08:31 PM
AddEvent with ComboBox erik58 Questions (Windows Mobile) 2 05-24-2008 02:38 PM
Problem with AddEvent and ImageList Haschi0 Questions (Windows Mobile) 7 03-01-2008 11:06 AM
Addevent Table tvrman Questions (Windows Mobile) 3 09-30-2007 06:33 AM
Problem using AddEvent EdQas Questions (Windows Mobile) 7 09-09-2007 09:51 AM


All times are GMT. The time now is 09:14 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0