"AddEvent" and "buttonUp/buttonDown"

Byak@

Active Member
Licensed User
if i'm use
B4X:
addevent("button1",click,"b_click")
it work fine.but if i'm use
B4X:
addevent("imagebutton1",buttonup,"b_click")
it's not work.why?:confused:
 

Cableguy

Expert
Licensed User
The b4p imagebutton does NOT support buttonup or buttondown, only the click event..
To Trap those events, you must use the door lib, and add the event from it...
 

Byak@

Active Member
Licensed User
stop!you not right!imagebutton support buttonup and buttondown!when i creat this event from IDE it's work fine.
 

Cableguy

Expert
Licensed User
Open the IDE in the form designer, add an image button, select it and choose EVENTS... only the click event is visible FROM WITHIN basic4ppc...
 

Cableguy

Expert
Licensed User
Ok, Sorry!!!
I'm at work and I only have the 5.5 version of the IDE, in my work PC, but remeber that the events name are case sensitive...
So you should try "ButtonUp" and "ButtonDown"....
 

Byak@

Active Member
Licensed User
nothing to sorry,all ok =)

i'm try some variants and what i'm see:
when i'm use
B4X:
sub app_start
form1.show
addevent("imagebutton1",ButtonDown,"b1")
end sub

sub b1
msgbox(1)
end sub
it's not work BUT when i'm use
B4X:
sub app_start
form1.show
addevent("imagebutton1",ButtonDown,"b1")
end sub

sub b1
msgbox(1)
end sub

sub imagebutton1_ButtonDown

end sub
it's work!!!
but it's not good,my programm contain ~30 buttons
how can i add event without creating it with IDE
 

agraham

Expert
Licensed User
Actually the event names are not case-sensitive in B4ppc. It is only when using the Door library that things become case-sensitive. This seems to be an IDE bug. Both legacy and compiled apps add the event OK (in version 6.42 at least), the IDE doesn't.
 

agraham

Expert
Licensed User
Various ways. If they are labelled sequentially then something like this.
B4X:
Sub App_Start
  Form1.Show
  For i = 1 To 30
    AddEvent("ImageButton" & i, click, "Down")
  Next      
End Sub

Sub Down
  Msgbox(Sender)
End Sub
 

Byak@

Active Member
Licensed User
no...they are labelled sequentially but you use event "click".but i want "ButtonDown" event!!!and it is big problem
 

agraham

Expert
Licensed User
I'm sorry but I don't understand the problem. You would just replace "click" with "buttondown" and it will work compiled but not in the IDE until the bug is fixed.
 
Top