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

A list example with data

Discuss OrbForms Designer and PocketC Architect

Postby fredoak on Mon May 20, 2002 1:10 pm

How about an example of populating a list with data. I can't seem to get it to work.
fredoak
 
Posts: 32
Joined: Tue May 14, 2002 10:54 am
Location: USA

Postby fredoak on Wed May 22, 2002 11:30 am

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?
fredoak
 
Posts: 32
Joined: Tue May 14, 2002 10:54 am
Location: USA

Postby fredoak on Wed May 22, 2002 3:49 pm

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!
fredoak
 
Posts: 32
Joined: Tue May 14, 2002 10:54 am
Location: USA

Postby jims on Wed May 22, 2002 4:04 pm

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.
jims
 
Posts: 34
Joined: Wed May 22, 2002 4:01 pm
Location: USA

Postby fredoak on Wed May 22, 2002 5:07 pm

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.
fredoak
 
Posts: 32
Joined: Tue May 14, 2002 10:54 am
Location: USA

Postby jims on Wed May 22, 2002 6:27 pm

Just populate the StringList and call setitemslist instead of setitems.

StringList status;
...
status.add(entry.per.rnam);
...
listRes.setitemslist(status);
...
jims
 
Posts: 34
Joined: Wed May 22, 2002 4:01 pm
Location: USA

Postby fredoak on Fri May 24, 2002 11:34 am

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.
fredoak
 
Posts: 32
Joined: Tue May 14, 2002 10:54 am
Location: USA


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 3 guests

cron