in a loop to serveral ImageButtons in RunTime. But they did not trigger.
In my routines I will change the look of those ImageButtons while they are pressed with a different Image from a ImageList.
If I set they with single events with the Designer it will work. If I use Click instead of ButtonDown or ButtonUp it will work too.
If the sub will be called, it will change the image, but it shows me a red rectangle with a cross in it.
Thanks for any help
If I send the image from the ImageList to the form, it will appear correctly.
I have no idea what's going on.
Maybe someone had the same trouble before and shares the solution or have another idea.
The following function will called to show form (it is a key pad with 3x4 ImageButtons)
Sub ShowNumForm
For i = 0 To 3 Step 1
For j = 1 To 3 Step 1
AddEvent("ib"&j+i*3,ButtonDown,"frmNum_ButtonDown" )
AddEvent("ib"&j+i*3,ButtonUp,"frmNum_ButtonUp")
AddEvent("ib"&j+i*3,Click,"frmNum_Click")[/indent]Next j
Next i
frmNum.Show
End Sub
Sub frmNum_ButtonDown
Sender.Image = il1.Item(3)
End Sub
Sub frmNum_ButtonUp
Sender.Image = il1.Item(2)
End Sub
Sub frmNum_Click
ValPanel.Text = ValPanel.Text & Sender.Text
End Sub
The il1 is a ImageList filled up with (serveral) Images for the buttons.
The ImageButtons are not created by AddImageButton Function, they are set with the designer.
The frmNum_Click Function will trigger if I press a button. But not the Button Up nor Down.
If I use the Designer to create the Events for one of those Buttons (Event for Up and Down) then it works.
But there I have my second problem. The Image will not changed or it get the wrong one. Actually I found that this will happens only if I use transparent. If it is not transparent, then the correct image will show on ButtonDown and Up.
If you could not exactly understand what I mean, I'm sorry for my english, lol.
Yes, that is what I mean too. If you take a look in the help file, you will see, that the ImageButton has the Events ButtonDown ButtonUp Click listed.
But if you look at AddEvent(), the ImageButton is not listet as a Control which support events.
My opinion was: There is the button listed and ImageButton is a member of buttons or buttons are the parent of it and ImageButton will inherit the same events. After a look at the designer by Events for a ImageButton, I found it there too. So for me it was clear. ImageButon has those three events.
Now I think it is forgotten to implement or the connections from the Button Class do not trigger correctly.
How ever, it is a work for Erel I think. You and me can't found a wrong code on this smal example and it is a quite easy one.
At time I use the FormEvent MouseDown(x,y) and MouseUp(x,y) for analysing the position and for to get my information which button is down or up.
I think that I am also right in saying that catching the mouseup/down event on the form won't work when run on the device because the imagebutton blocks the event from happening, unlike on the desktop.
Regards,
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
I didn't known this. I didn't have test my application on ppc.
At time I'm on beginning to develope a new project and I think it will need a longer time to finish. If Erel has released a new version with those events, I will use that one. But I will take a look on DZT's Magic Events. Maybe this one is helpfull for other points too.