Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


AddEvent but no RemoveEvent??


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-19-2008, 05:13 PM
LineCutter's Avatar
Senior Member
 
Join Date: May 2007
Location: Daarsit
Posts: 118
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", 10, 10 ,225, 255)
    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, 05:56 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,770
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

It's a bug. See this thread Different behavior in desktop vs. device on AddEvent

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, 06:09 PM
LineCutter's Avatar
Senior Member
 
Join Date: May 2007
Location: Daarsit
Posts: 118
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 On
Pingbacks are On
Refbacks are On

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


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


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0