Android Question using 'invalid' events

nikolaus

Member
Licensed User
Longtime User
Hi,

I'm rather new to B4A and I'm wondering wether there is a reason for 'invalid' events. In B4As Beginners Guide, p.241 / chapter 14.6 there is a list of valid events for different views. This corresponds to the events that can be created through Designer's 'Generate Members' option.

However I found other events working well (but did not test all combinations). E.g. following code runs flawlessly:

Private ToggleAsButtonTest As ToggleButton
...
Sub ToggleAsButtonTest_Click
ToggleAsButtonTest.Checked = True
Msgbox("OK","")
ToggleAsButtonTest.Checked = False
End Sub

This is just some test code to use a toggle button with its graphic indicator as a simple button.

Using 'invalid' events on other views worked whatever I tried, too.

Is there any deeper reason that not all events are listed as valid for all views?
Do I have to expect unwanted side effects or (future) compatibility issues using 'invalid' events.

Thanks
Nikolaus
 

LucaMs

Expert
Licensed User
Longtime User
Without using the Guide, you can learn about the events supported by an object as follows:

write Sub, press the space bar, then the tab key. At this point, you can choose an item from the list displayed (even typing the first few letters of its name) and still press the tab key: valid events will be listed; selecting one of them and pressing TAB, you will be allowed to enter the EventName (incorrect definition) that you have associated with the object during its initialization.

it is difficult to explain, especially for an Italian :), easy to do:

Sub SPACEBAR rad TAB TAB (RadioButton) TAB (CheckedChange) TAB "MyRB"
 
Upvote 0

nikolaus

Member
Licensed User
Longtime User
Luca, thank you. This is not my problem and maybe I didn't explain it well.

In the documentation as in Designer:GenerateMembers (as in autocomplete) for different views there are different selections of available events shown. However using the event _click in code on views that do not list this event works flawless in my environment,

What I'd like to know why events are restricted in the IDE. Is it just a decision (whatever) or are there relevant incompatibilities or side effects.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
You're right.

ToggleButton1_LongClick also fires.

Probably these are inherited common events .

To find out what they are we have only two possibilities:

a) try the possible events
b) wait for the response of Erel (I like this one much more :D)


However, I do not think there are problems: if you do not implement the LongClick routine, for example, can not happen anything.

Indeed, there may be some advantages in your discovery!
 
Upvote 0

nikolaus

Member
Licensed User
Longtime User
Hi Erel,

that's what I wanted to know. If these events are unwanted - and not by design - will you try to fix that or can we rely on these events working in future B4A releases?
Maybe it makes sense to hide them (I would not) but anyway. I think an 'official' decision whether they are a feature or a bug is necessary.
 
Upvote 0
Top