[Gambas-user] Re: How do events work? part 2

R Onstenk ronstk at ...239...
Sun Aug 31 20:41:37 CEST 2003


Well the story goes on. Part 2.

Starting with:
PUBLIC SUB cbxParent_LostFocus()'Raised when the control loses the focus.
did not work in my trial.

----8<-------------
' PRIVATE was not doing anything
' made it PUBLIC give stack overflow
' add STATIC still not working
' the the last one STATIC PRIVATE, also not working
' what hell is going wrong?
STATIC PRIVATE SUB cbxProduct_LostFocus()'Raised when the control loses the
focus.
  Message ("cbxProduct_LostFocus")
END
------->8--------
I have to confess, I did type it simple in my code.

So I restart reading the docs and special the one with the BIG picture did
it.
In the HowTo 'use Events' at
http://www.theeasygambasdoku.de/events/index.html

Thats nice. This is far better then the counterpart. There is dblclick
creating simply the first one and for shure not the one you want.
Here you can nice directly select the right one and I did it that way.
Of cource I had my code commented out to compare the difference later.

So I select the cbxProduct contol, then the LostFocus and arives in the code
part to edit wat must be done and found just what I did typed in first
trial.
PUBLIC SUB cbxParent_LostFocus()

END

Added a PRINT "cbxParent_LostFocus" in it and tested. Working!
Did the same thing for another event and tested. Working!
Now I was a bit in a hurry and simple cut and paste it several times
correcting the names_event so I end up with my posted example.
The only difference is PRINT instead of MESSAGE and all working.
Add the calls to my SUBs and working.

I asumed that in the text describing the form there was also binding
of events. In that way it was my fault to behave like VB where you
simply type the event procudure (the object must exists of course) and
go on. But also I know that in the VB code for the part describing the
form there is no event binding. I was interested if it was done in a
Gambas form so I look in the text with MC and found nothing in that way.

I am lost why it works now but I have to confess it does also not
realy what i want to do with those events, bad idee of me. One thing
I did not try to checkout is if it works with MESSAGE as I had used
in the first trial but the click event had it during the test so i
asume it is the reason and the MESSAGE was added because the event
did not run the required SUB.

Note:
  Popup a MESSAGE had changed the focus so the events should go
  behave as idiots after all. This for other users, who try to
  help the end user on those events with a MESSAGE popup.




















More information about the User mailing list