LB Booster
« Events »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:48am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Events  (Read 593 times)
joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx Events
« Thread started on: Nov 6th, 2015, 12:39am »

I guess I'm dense ... or perhaps I should have paid for the Microsoft manuals.

I haven't found a list of events to write handlers for.

Certainly this isn't something traditionally handed down amongst generations of programmers. Perhaps it comes with the "tea" at some annual convention of Windows guys and gals.

I jest, but why isn't this a prominent list in at least one tutorial? Perhaps I'm just dense.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Events
« Reply #1 on: Nov 6th, 2015, 02:11am »

on Nov 6th, 2015, 12:39am, pnlawrence wrote:
I haven't found a list of events to write handlers for.

I can't say I've ever seen a comprehensive list either, but searching for handler in the LBB help viewer allowed me to compile this:

Code:
BMPBUTTON #window[.ext], bmpfile$, handler, anchor, posx, posy
BUTTON #window[.ext], "text", handler, anchor, xpos, ypos [, width, height]
CHECKBOX #window[.ext], "Caption", sethandler, resethandler, xpos, ypos, width, height
COMBOBOX #window[.ext], array$(), handler, xpos, ypos, width, height
LISTBOX #window.ext, array$(), handler, xpos, ypos, width, height
MENU #handle, "title", "text", handler {, "text", handler}
ONCOMERROR [handler]
POPUPMENU "text", handler {, "text", handler}
RADIOBUTTON #handle.ext, "label", sethandler, resethandler, xpos, ypos, width, height
SPRITETRAVELXY sprite x y speed handler (sprites)
TIMER milliseconds, handler | 0
TRAPCLOSE handler (any window)
WHEN event handler (graphicbox or graphics window) 

From the LB 4.5.0 docs the WHEN events are:

Code:
WHEN leftButtonDown
WHEN leftButtonUp
WHEN leftButtonMove
WHEN leftButtonDouble
WHEN rightButtonDown
WHEN rightButtonUp
WHEN rightButtonMove
WHEN rightButtonDouble
WHEN middleButtonDown
WHEN middleButtonUp
WHEN middleButtonMove
WHEN middleButtonDouble
WHEN mouseMove
WHEN characterInput 

If I've missed any I'm sure somebody will point it out.

Richard.
User IP Logged

joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx Re: Events
« Reply #2 on: Nov 6th, 2015, 10:35am »

You second example is what I'm wanting. The following is from the LB help file:

Quote:
Controls and Events

The commands to create a controls must specify event handlers that are associated with user actions made on those controls (clicking, double-clicking, selecting, etc.).


I don't see how I can create handlers for "user actions" if I don't know what the "user actions" are that the control is capable of returning.

I find it hard to believe that their isn't a comprehensive list of "user actions" by now.

I suppose that one would just visit the Microsoft page where the control was specified?
User IP Logged

joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx Re: Events
« Reply #3 on: Nov 6th, 2015, 11:07am »

Now, I'm getting somewhere.

https://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.button.aspx

I suppose I have to find each control I'm using and get the events for that control.

Maybe it is time for a wiki article? cheesy

EDIT: Perhaps this is a better reference?
EDIT: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj203560.aspx
« Last Edit: Nov 6th, 2015, 11:18am by joker » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Events
« Reply #4 on: Nov 6th, 2015, 1:34pm »

on Nov 6th, 2015, 10:35am, pnlawrence wrote:
I suppose that one would just visit the Microsoft page where the control was specified?

It's not likely to be very helpful. MSDN will list all the possible events that a control can generate, but it won't tell you which you get notified of in Liberty BASIC.

For example MSDN will tell you that a COMBOBOX can generate notifications when it gains or loses input focus, when the list drops down, when the selection is changed, when the contents of its edit box is modified etc. But the only one of those you get notified of in LB is the selection-changed event.

You should be able to find, in the LB Help docs, a description of what event(s) each control notifies you of. For example in the case of the COMBOBOX, under the description of eventHandler, it states "This is the branch label or subroutine where execution begins when the user selects an item from the combobox by clicking it".

But I've not seen them collated in one place.

Edit: As far as I know, this is the full list of events that can be generated by controls:

BMPBUTTON: When the button is clicked
BUTTON: When the button is clicked.
CHECKBOX: When the box is checked (sethandler) or unchecked (resethandler).
COMBOBOX: When the selection changes.
LISTBOX: When the control is double-clicked (or, if a SINGLECLICKSELECT command has been issued, when the selection changes).
RADIOBUTTON: When the selected button changes (sethandler); the resethandler event occurs rarely and should usually be ignored.

There's an undocumented feature of LB whereby you can enable both single- and double-click events from a listbox. I do not support that in LBB, although I could.

Richard.
« Last Edit: Nov 6th, 2015, 1:52pm by Richard Russell » User IP Logged

joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx Re: Events
« Reply #5 on: Nov 6th, 2015, 2:28pm »

Geez, and here I was thinking of the enormous task in front of me and it all boils down to 6 events. I was incorrect in assuming the LB docs just couldn't be correct!

Quote:
BMPBUTTON: When the button is clicked
BUTTON: When the button is clicked.
CHECKBOX: When the box is checked (sethandler) or unchecked (resethandler).
COMBOBOX: When the selection changes.
LISTBOX: When the control is double-clicked (or, if a SINGLECLICKSELECT command has been issued, when the selection changes).
RADIOBUTTON: When the selected button changes (sethandler); the resethandler event occurs rarely and should usually be ignored.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Events
« Reply #6 on: Nov 7th, 2015, 12:27am »

"There's an undocumented feature of LB whereby you can enable both single- and double-click events from a listbox. I do not support that in LBB, although I could."

I have a program that DOES use both single and double click events
because I need to do two different things, and I didn't want to use a menu with only two choices.
I hope you will support this feature in the future.

By happenstance, in that same program I get an error on this statement (which works in LB)
Code:
today = val(date$("days"))
 


I had to use these two lines, instead

Code:
today$ = date$("days")
today = val(today$)
 


r.m.
User IP Logged

joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx Re: Events
« Reply #7 on: Nov 7th, 2015, 01:29am »

Alincon, you should have started another thread, because your problem with the date will get lost if someone searches.

Anything we can do to keep Richard engaged in updating LBB is a good thing! cheesy
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Events
« Reply #8 on: Nov 7th, 2015, 09:50am »

on Nov 7th, 2015, 12:27am, Alincon wrote:
By happenstance, in that same program I get an error on this statement (which works in LB).

It only works in LB because of a bug. The docs clearly state that the function date$("days") returns a numeric value, not a string:

"print date$("days") ' 36127 returns number - days since Jan 1, 1901".

So of course if you do val(date$("days")) it is a Type Mismatch - the VAL() function expects a string parameter, not a numeric parameter.

The correct code (which will work in JB, LB 4.04, LB 4.5.0 and LBB) is:

Code:
today = date$("days") 

I won't be changing LBB to emulate the bug; the fault is in your program.

Richard.
« Last Edit: Nov 7th, 2015, 10:05am by Richard Russell » User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Events
« Reply #9 on: Nov 8th, 2015, 9:53pm »

I agree that my code was wrong, your is right, and I should have known better.

Just one more question: why do you let both of these work?

Code:
today = date$("days") 
today$ = date$("days") 
 


r.m.



User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls