2.6 version

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.6 version

Post by Mr. Kibernetik »

New commands will be added:

SLIDER n$ SET VALUE k
sets value [k] for slider with name [n$]. Valid values for [k] are from 0 to 1.

FIELD n$ SET TEXT a$
sets text [a$] for text input field with name [n$].

SWITCH n$ SET STATE k
sets state [k] for switch with name [n$]. If [k] = 0 then switch is off, otherwise it is on.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.6 version

Post by Mr. Kibernetik »

New command will be added:

BUTTON n$ SET TITLE a$
sets title [a$] for button with name [n$].

Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: 2.6 version

Post by Henko »

For objects BUTTON and FIELD we have functions BUTTON-PRESSED() and FIELD-CHANGED(), or generic: OBJECT-TOUCHED()
IMO the new objects SWITCH and SLIDE should also have such functions.

Very nice to have the new UI objects! It is an enrichment of this Basic!
Maybe you could consider adding a scrollable LISTBOX ?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.6 version

Post by Mr. Kibernetik »

Henko wrote:For objects BUTTON and FIELD we have functions BUTTON-PRESSED() and FIELD-CHANGED(), or generic: OBJECT-TOUCHED()
IMO the new objects SWITCH and SLIDE should also have such functions.

Very nice to have the new UI objects! It is an enrichment of this Basic!
Maybe you could consider adding a scrollable LISTBOX ?
Switch and slider has no generic "changed" state because they always return meaningful value: state for switch and value for slider.
For button meaningful value is its "pressed" state, and for field we have "changed" value because it says that user finished typing text.

Yes, currently LIST object is under construction and it will be ready soon with several commands.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.6 version

Post by Mr. Kibernetik »

New commands will be added:

SET LISTS CUSTOM
SET LISTS DEFAULT
set newly created lists to be of "CUSTOM" or "DEFAULT" type. Custom list type means that when list is created its text color and opacity are defined by draw color and alpha, also its background color and opacity are defined by fill color and alpha. Default list type means that lists have standard appearance.

New interface object "list" will be added with commands:

LIST n$ DELETE
deletes list with name [n$].

LIST n$ SET SELECTION k
selects row with number [k] in list with name [n$]. To clear selection, set row number to -1.
OPTION BASE command affects this command.

LIST n$ SET TEXT m
sets contents of list with name [n$] equal to contents of one-dimensional array [m].

LIST n$ TEXT m AT x,y SIZE w,h
creates list with name [n$], with contents of one-dimensional array [m], at point [x,y] and with size [w,h].
SET LISTS command affects appearance of newly created lists.

LIST_SELECTED (n$)
returns number of selected row in list with name [n$]. If nothing is selected then returns -1.
OPTION BASE command affects this function.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.6 version

Post by Mr. Kibernetik »

New unique syntax of scope variables will be introduced:

Although all variables are local, smart BASIC allows you to use any variable from any function inside any other function. For this purpose you can use scope variable syntax as "scope.name", where "scope" is variable definition scope and "name" is variable name. For example, if in your program F function is defined:
DEF F(X)
X2 = X^2
X3 = X^3
F = X2 + X3
END DEF
then you can get access to its local variables X2 and X3 outside of this function like this:
X = F(2)
PRINT X; F.X2; F.X3

Scope variable syntax allows you directly set function parameters and get any number of function results.

So called "global" variables, when you get access to variables outside the function, in scope variables syntax looks similar but without any scope:
DEF F
F = .X^2
END DEF

X = 2
PRINT F

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.6 version

Post by Mr. Kibernetik »

Henko wrote:For objects BUTTON and FIELD we have functions BUTTON-PRESSED() and FIELD-CHANGED(), or generic: OBJECT-TOUCHED()
IMO the new objects SWITCH and SLIDE should also have such functions.
Yes, functions SWITCH_CHANGED() and SLIDER_CHANGED() will be available in version 2.7.

Post Reply