Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - A list example with data
Page 1 of 1

PostPosted: Mon May 20, 2002 1:10 pm
by fredoak
How about an example of populating a list with data. I can't seem to get it to work.

PostPosted: Wed May 22, 2002 11:30 am
by fredoak
Ok here is what I've come up with so far but it doesn't populate right and corrupts the originating data.

handler ResList.onopen() {
string record, status[10];
int choice, nRecords;
Database db;

// open the database
if (db.open("NRGR_Data", true)) }
nRecords = db.nrecs;
}
db.close();
for(choice = 0; choice< nRecords; choice++){
record = entry.per.rnam;
status[choice]= record;
appPrefs.iRecord++;
}
listRes.setitems(nRecords, status)
}

any ideas anyone?

PostPosted: Wed May 22, 2002 3:49 pm
by fredoak
OK I got the list populated here is the code example...
handler ResList.onopen()
{
string status[9];
int choice, nRecords;
Database db;
DBRecord rec;
// open the database
if (db.open("NRGR_Data", true))
{
nRecords = db.nrecs;
lblRecs.text = "Total Records " + nRecords;
}
db.close();
if (db.open("NRGR_Data", true))
appPrefs.iRecord = 0;
{
for(choice = 0; choice< nRecords+1; choice++)
{
if (db.getrec(appPrefs.iRecord, rec, true))
{
rec.read(&entry, typeof(entry), 1);
status[choice]= entry.per.rnam;
rec.close();
}
appPrefs.iRecord++;
}
}
listRes.setitems(nRecords, status);
db.close();
}

now on to tackle the onselect event!

PostPosted: Wed May 22, 2002 4:04 pm
by jims
I'd suggest using a StringList for your "status" variable instead of an array of strings.
The string list is easier to dynamicly allocate memory.
I can give you an example if necessary.

PostPosted: Wed May 22, 2002 5:07 pm
by fredoak
Yes, I'm not sure I understand the populating of the list with a StringList.
I see how to add to the string list but don't see how to populate the list when setitems is looking for an array of strings.

PostPosted: Wed May 22, 2002 6:27 pm
by jims
Just populate the StringList and call setitemslist instead of setitems.

StringList status;
...
status.add(entry.per.rnam);
...
listRes.setitemslist(status);
...

PostPosted: Fri May 24, 2002 11:34 am
by fredoak
Thanks Jim,

That worked great and I see what you mean about the dynamic memory. A lot easier to clear out when I'm done. Also solved my problem with the onselect from the list as it was much easier to assign back the record index.
Now if we just had tables I could really use this for commercial development.