Dynamic Combobox and Choice data

Discuss GUI programming with the RapaGUI plugin here

Dynamic Combobox and Choice data

Postby Redlion » Fri Jul 08, 2016 1:05 pm

Hi all,

I was trying to load data into a combobox and a choice gadget from a file.

I have tried moai.set("combo", -1, Data$ ), I can not seem to find the right syntax?

Has anyone been able to do this.

Is it possible to do?

Cheers
Leo
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
User avatar
Redlion
 
Posts: 62
Joined: Sun Jul 10, 2011 5:05 am
Location: Perth, Western Australia

Re: Dynamic Combobox and Choice data

Postby airsoftsoftwair » Fri Jul 08, 2016 10:28 pm

Unfortunately, this is currently unsupported but it's planned for the future...
User avatar
airsoftsoftwair
 
Posts: 2233
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Dynamic Combobox and Choice data

Postby ilbarbax » Thu Oct 13, 2016 9:08 am

I did in this way. At least it works the first time you open the xml file to populate the choice box from a file.

I created a text file with my entries like this one
Abarth
Acura
Alfa Romeo
AM General
American Motors
Aston Martin


then I modified the xml file in such way

...
<label>Maker:</label>
<choice>
##MAKERS##
</choice>


then i id did that it the hws code:

aa$=""
For s$ In FileLines("Makers.txt") Do aa$=aa$.."<item>"..s$.."</item>"..Chr(10)

f$=FileToString("my_car.xml")
f$=ReplaceStr(f$,"##MAKERS##",aa$)

moai.CreateApp(f$)
ilbarbax
 
Posts: 77
Joined: Thu Apr 01, 2010 6:41 pm

Re: Dynamic Combobox and Choice data

Postby airsoftsoftwair » Thu Oct 13, 2016 5:24 pm

Of course, you could always use moai.CreateObject() to create a a combobox dynamically and then add it using Group.Insert(), Group.Append() or Group.Prepend(). This allows you to work around the limitation that you currently cannot modify the contents of a choice widget.
User avatar
airsoftsoftwair
 
Posts: 2233
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Dynamic Combobox and Choice data

Postby airsoftsoftwair » Sun Nov 13, 2016 1:58 pm

Code: Select all
- New: Added new methods and attributes for Combobox class which make it much more
  flexible; the following new methods are now supported: Combobox.Clear(), Combobox.GetEntry(),
  Combobox.Insert(), Combobox.Remove(), and Combobox.Rename(); additionally, a
  Combobox.Count [G] attribute has been added to allow you to query the number of
  items in a combobox
User avatar
airsoftsoftwair
 
Posts: 2233
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Dynamic Combobox and Choice data

Postby airsoftsoftwair » Thu Nov 17, 2016 5:43 pm

Code: Select all
- New: Added new methods and attributes for Choice class which make it much more
  flexible; the following new methods are now supported: Choice.Clear(), Choice.GetEntry(),
  Choice.Insert(), Choice.Remove(), and Choice.Rename(); additionally, a Choice.Count [G]
  attribute has been added to allow you to query the number of items in the widget;
  finally, it is now possible to declare empty choice widgets in XML, i.e. you needn't
  add items in XML any longer but you can simply do this later at runtime using the
  new methods; also note that only Choice.GetEntry() and Choice.Count [G] are compatible
  with MUI 3.8; all other methods need MUI 4 or better
User avatar
airsoftsoftwair
 
Posts: 2233
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Dynamic Combobox and Choice data

Postby ilbarbax » Fri Nov 18, 2016 6:08 pm

Excellent...awaiting for next release
ilbarbax
 
Posts: 77
Joined: Thu Apr 01, 2010 6:41 pm


Return to RapaGUI

Who is online

Users browsing this forum: No registered users and 1 guest