Page 1 of 1

List_box object

Posted: Sun Apr 14, 2013 11:47 am
by Henko
Rem list_box object in function format. May be usefull in some app's.
Rem

Program slightly modified, see next posting

Re: List_box object

Posted: Sun Apr 14, 2013 3:53 pm
by Mr. Kibernetik
Very interesting code!
I have several comments:

1. You can safely write
IF BUTTON_PRESSED("ok") THEN
instead of
IF BUTTON_PRESSED("ok")=1 THEN

2. You can use GRAPHICS CLEAR x,x,x to clear screen instead of FILL RECT 0,0 TO ...

Currently if you select city twice it becomes black color again.

Re: List_box object

Posted: Sun Apr 14, 2013 6:40 pm
by Henko
Mr. Kibernetik wrote:Very interesting code!
I have several comments:

1. You can safely write
IF BUTTON_PRESSED("ok") THEN
instead of
IF BUTTON_PRESSED("ok")=1 THEN

Yep, thanks

2. You can use GRAPHICS CLEAR x,x,x to clear screen instead of FILL RECT 0,0 TO ...

Thanks again, must read manual now and then :?

Currently if you select city twice it becomes black color again.
Indeed. The idea is that a selected item can be deselected again; but internally the item remained selected. I have changed that in the modified version.

Another change is that the width of the list_box (last item in the parameter list) will be calculated by the function if that parameter is given the value zero.