Source language: Translate to:

NeoAppBuilder Listbox

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

NeoAppBuilder Listbox

Postby fkapnist » Thu Jun 16, 2016 6:16 am

I am trying to use the list box in NeoAppBuilder but I am not sure where the NeoAppBuilder [vars] interact with JavaScript variables....

Code: Select all
 onChange = "thevar=this.options[ this.selectedIndex ].value;"
alert(thevar);


The above JavaScript doesn't work. Neither does this:

Code: Select all
SetVar [info] "this.options[ this.selectedIndex ].value"
jsAlert "[info]"


How can I rewrite it for NeoAppBuilder?

:?:
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Re: NeoAppBuilder Listbox

Postby Gaev » Thu Jun 16, 2016 7:32 am

fkapnist:

1) in the Properties tab for the ListBox ...

a) define (NeoScript) variables for the property called items ... e.g. [ListBox2items]

b) define (NeoScript) variables for the property called variable ... e.g. [ListBox2Variable]

c) optionally ... define (NeoScript) variables for the property called initial-value ... e.g. Banana

2) Now you can try NeoScript commands like ...
Code: Select all
AlertBox "ListBox2Items" "...[ListBox2Items]..." ""
AlertBox "ListBox2Variable" "[ListBox2Variable]" ""
ArrayDelItem [ListBox2Items] 1

... and if you prefer to code in Javascript, you can access the content of these Neo Variables using something like ...
Code: Select all
BeginJS
alert( $rootScope.ListBox2Variable );
$rootScope.ListBox2Variable = “Cherry”;
EndJS
User avatar
Gaev
 
Posts: 3737
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: NeoAppBuilder Listbox

Postby fkapnist » Thu Jun 16, 2016 8:18 am

Gaev wrote:fkapnist:

1) in the Properties tab for the ListBox ...

a) define (NeoScript) variables for the property called items ... e.g. [ListBox2items]

b) define (NeoScript) variables for the property called variable ... e.g. [ListBox2Variable]

c) optionally ... define (NeoScript) variables for the property called initial-value ... e.g. Banana

2) Now you can try NeoScript commands like ...
Code: Select all
AlertBox "ListBox2Items" "...[ListBox2Items]..." ""
AlertBox "ListBox2Variable" "[ListBox2Variable]" ""
ArrayDelItem [ListBox2Items] 1

... and if you prefer to code in Javascript, you can access the content of these Neo Variables using something like ...
Code: Select all
BeginJS
alert( $rootScope.ListBox2Variable );
$rootScope.ListBox2Variable = “Cherry”;
EndJS


--------------------------------

Thank you Gaev. I would like to show an HTML script in the listbox, line by line. But how do I convert the HTML so it won't break the listbox display?

.
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Re: NeoAppBuilder Listbox

Postby Gaev » Thu Jun 16, 2016 9:05 am

fkapnist:

I would like to show an HTML script in the listbox, line by line. But how do I convert the HTML so it won't break the listbox display?


I don't think you can specify "rich text" for ListBox items ... I tried this ...
Code: Select all
CreateArray [ListBox2Items] "Apple,Banana,Cherry,<b>Donkey</b>"

... and it displays ...

Apple
Banana
Cherry
<b>Donkey</b>

If you have an example website that displays such "rich text", please provide a link.
User avatar
Gaev
 
Posts: 3737
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: NeoAppBuilder Listbox

Postby Gaev » Thu Jun 16, 2016 9:11 am

fkapnist:

But this example code ...
Code: Select all
<div class="container">
  <h2>Basic List Group</h2>
  <ul class="list-group">
    <li class="list-group-item"><b>First item</b></li>
    <li class="list-group-item">Second item</li>
    <li class="list-group-item">Third item</li>
  </ul>
</div>

... modified from example here ... http://www.w3schools.com/bootstrap/tryi ... &stacked=h ... produces the desired result.

So you might consider using a Container object instead ... then dynamically compose its contents as above.
User avatar
Gaev
 
Posts: 3737
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: NeoAppBuilder Listbox

Postby fkapnist » Thu Jun 16, 2016 11:58 am

Gaev wrote:fkapnist:

But this example code ...
Code: Select all
<div class="container">
  <h2>Basic List Group</h2>
  <ul class="list-group">
    <li class="list-group-item"><b>First item</b></li>
    <li class="list-group-item">Second item</li>
    <li class="list-group-item">Third item</li>
  </ul>
</div>

... modified from example here ... http://www.w3schools.com/bootstrap/tryi ... &stacked=h ... produces the desired result.

So you might consider using a Container object instead ... then dynamically compose its contents as above.


I do not want to display rich text in a list box. I just want plain text of the lines of code. Maybe the tags < /> can be replaced with <option> </option> before being displayed? I am sure there is some script out there that can do it...
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Re: NeoAppBuilder Listbox

Postby fkapnist » Thu Jun 16, 2016 12:10 pm

Gaev wrote:fkapnist:

I would like to show an HTML script in the listbox, line by line. But how do I convert the HTML so it won't break the listbox display?


I don't think you can specify "rich text" for ListBox items ... I tried this ...
Code: Select all
CreateArray [ListBox2Items] "Apple,Banana,Cherry,<b>Donkey</b>"

... and it displays ...

Apple
Banana
Cherry
<b>Donkey</b>

If you have an example website that displays such "rich text", please provide a link.



If you have an example website that displays such "rich text", please provide a link.

This is pretty close to it:

http://www.marghoobsuleman.com/jquery-image-dropdown

Download the script here:

https://github.com/marghoobsuleman/ms-Dropdown

:idea:

.
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Re: NeoAppBuilder Listbox

Postby Gaev » Thu Jun 16, 2016 1:52 pm

fkapnist:

I do not want to display rich text in a list box. I just want plain text of the lines of code. Maybe the tags < /> can be replaced with <option> </option> before being displayed? I am sure there is some script out there that can do it...

If you want to display plain text for each item of a Dropdown, then NeoAppbuilder's widget will do fine.

Expanding on my previous example, in order to load/add items ...
Code: Select all
CreateArray [ListBox2Items] "Egg,Fish,Chicken"
ArrayAddItem [ListBox2Items] "Pork"
ArrayAddItem [ListBox2Items] "Beef"
SetVar "[ListBox2Variable]" "Chicken"

... to customise it to your specific needs, replace Pork, Beef, Chicken etc. with text (including html tags) that is part of the script that you want to display ... something like ...
Code: Select all
CreateArray [ListBox2Items] ""
ArrayAddItem [ListBox2Items] "<select name='webmenu' id='webmenu'  onchange='showValue(this.value)'>"
ArrayAddItem [ListBox2Items] "    <option value='calendar'>Calendar</option>"
ArrayAddItem [ListBox2Items] "    <option value='shopping_cart'>Shopping Cart</option>"
ArrayAddItem [ListBox2Items] "    <option value='cd'>CD</option>"
ArrayAddItem [ListBox2Items] "    <option value='email'  selected='selected'>Email</option>"
ArrayAddItem [ListBox2Items] "    <option value='faq'>FAQ</option>"
ArrayAddItem [ListBox2Items] "    <option value='games'>Games</option>"
ArrayAddItem [ListBox2Items] "</select>"

... I replaced the inner double quotes with single quotes ... I am sure you can replace them with their respective code instead ... also I haven't explored the specification to have it show leading spaces in each line.

Finally, if you already have the lines of script in some sort of Array, you can setup a Loop/EndLoop (with just one ArrayAddItem within the Loop block).
User avatar
Gaev
 
Posts: 3737
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron