0

Combobox filling

asked 2008-11-10 16:39:35 +0800

dftimoteo gravatar image dftimoteo
9

Hi!!!

I need to fill a combobox with the result of a SQL query.Does anyone has an idea? is it better to get it from the direct result of the query or from an XML format? Anyone did it?

Tks a lot!

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2008-11-11 01:33:03 +0800

flyworld gravatar image flyworld
155 3

its doesn't matter where your data from, the important is that you have to cast them into an Array

<window id="win" title="test">
	<combobox id="cb2" width="300px" />
	<zscript><![CDATA[  
		String[] data = new String[30];
		for (int j = 0; j < data.length; ++j) {
			data = "Data " + j;
		}		
		ListModel lm = new SimpleListModel(data);  
		cb2.setModel(lm);
	]]></zscript>
</window>

then you can set it to combobox through a ListModel

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-11-10 16:39:35 +0800

Seen: 151 times

Last updated: Nov 11 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More