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

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

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

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

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

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

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

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[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 - More DB questions

More DB questions

Discuss OrbForms Designer and PocketC Architect

Postby Cyplesma on Sun Jan 18, 2004 10:17 pm

Can I;

clear a list box dynamically?

edit a record without erasing it and then writing it back to the db with the edited info?

can I edit an item on the list box?

I've tried several ways but they don't seem to work.

My main problem with trying to fill the list before was the .pdb file wasn't correct.

thanks.
Cyplesma
 
Posts: 17
Joined: Fri Jan 09, 2004 8:23 pm
Location: USA

Postby FrankG on Mon Jan 19, 2004 2:00 pm

>clear a list box dynamically?

I associate a StringList with my list boxes and manipulate the StringList in the way I want to manipulate the list box data (add, updae, delete entires or clear / load the list). I then issue a UIList.setlistitems(StringList) and UIList.visible = true. StringLists have a nice set of methods and properties.

> edit a record without erasing it and then writing
> it back to the db with the edited info?

I haven't found a way to do that. I do a removerec and an insert.

> can I edit an item on the list box?

? By that do you mean tap an item and have it open for editing? You could do that by:
- Create a field object and make it invisible.
- In the UIList tap event handler, move the field to an (x,y) position overlaying the taped list item), load it with the listitem data, and make the field visible.
- When the user is done editing (return stroke or maybe have a done/cancel set of buttons with the field) hide the field and load thenew list item in the list box and restore it.

You might need to hide the list box so that it doesn't respond to taps while you're editing.

I've done this with a DRAWed table on a gadget.

An alternative I've used is to have an edit field above or below the list box. When you tap an item, load it into the field.

HTH,
Frank
FrankG
 
Posts: 210
Joined: Thu Jan 23, 2003 7:58 pm

Postby Cyplesma on Wed Jan 21, 2004 6:42 pm

<font color="blue">>clear a list box dynamically?

I associate a StringList with my list boxes and manipulate the StringList in the way I want to manipulate the list box data (add, updae, delete entires or clear / load the list). I then issue a UIList.setlistitems(StringList) and UIList.visible = true. StringLists have a nice set of methods and properties.</font id="blue">

I tried this. Cause I was hoping to do this to help with editing an item in a list box (see below). I have my app setup so that the user taps on the list box, app reads the record, enters a couple of fields from the record and displays them above the list box. One is editable, one isn't. In the list box I'm concating the 2 fields so, after the user makes their changes I want the list box to be refreshed with the edited data.

I'm not doing something right to clear the list box, I can fill it.
I've tried the StringList.clear and then UIList.setlistitems(StringList), then reloaded the stringlist then reloaded the list box with the new string list, but my listbox displays the old stringlist and at the end is the second string list. so either the stringlist.clear isn't working for me, or the listbox isn't clearing correctly. true.





<font color="blue">> edit a record without erasing it and then writing
> it back to the db with the edited info?

I haven't found a way to do that. I do a removerec and an insert.</font id="blue">

OK. I do use my own set of record index numbers so I can just make sure I don't get those confused.


<font color="blue">> can I edit an item on the list box?

? By that do you mean tap an item and have it open for editing? You could do that by:
- Create a field object and make it invisible.
- In the UIList tap event handler, move the field to an (x,y) position overlaying the taped list item), load it with the listitem data, and make the field visible.
- When the user is done editing (return stroke or maybe have a done/cancel set of buttons with the field) hide the field and load thenew list item in the list box and restore it.

You might need to hide the list box so that it doesn't respond to taps while you're editing.

I've done this with a DRAWed table on a gadget.

An alternative I've used is to have an edit field above or below the list box. When you tap an item, load it into the field.</font id="blue">

see 1st question above
Cyplesma
 
Posts: 17
Joined: Fri Jan 09, 2004 8:23 pm
Location: USA

Postby Simon_Wolf on Thu Jan 22, 2004 9:12 am

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I'm not doing something right to clear the list box, I can fill it. I've tried the StringList.clear and then UIList.setlistitems(StringList), then reloaded the stringlist then reloaded the list box with the new string list, but my listbox displays the old stringlist and at the end is the second string list. so either the stringlist.clear isn't working for me, or the listbox isn't clearing correctly.<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

I'm not sure if this will help you (or even if it is good practice!) but I re-fill my stringlists by assigning the contents to a new, empty variable and then issuing the redraw method ...

StringList strlstData;

// clear the list
lstLookupList.setitemslist(strlstData);
lstLookupList.redraw();

It might be that you just need to redraw the list before filling it.

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">OK. I do use my own set of record index numbers so I can just make sure I don't get those confused.<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

Any tips for this? Do you just get the number of records and then add one (which I think will mess up after record deletions) or do you move the the last record, get its ID and add one to that or do something else? Do you, or anyone else, have any sample code for this which would save me some time? Pretty please. :D

Simon Wolf
Simon Wolf
Simon_Wolf
 
Posts: 22
Joined: Tue Dec 23, 2003 4:15 pm
Location: United Kingdom

Postby Cyplesma on Thu Jan 22, 2004 9:29 pm

record indexes:

I store a unique number field in the database.

struct ItemRecord {
int RecordID;
string FirstName;
string LastName;
int Age;
}

with orb's list box you do need to display the recordid field in the stringlist. Use a colon or semicolon to separate the fields which you also use to parse from the string later.

list items:
34:Dave Red
478:Gloria Sweet
12:Jessie James

with the above in the list box after you tap on Gloria Sweet, display her name in a text box, display the 478 in a invisible text box, then you read through the database till you find 478 read that record's age field display that in a text box. provide a save button and whenthe user clicks on the save button to save the new age, then use the hidden field with 478 in it to delete that record and write a new record with the new age value. then clear and refill the list box. I'm checking this form from work, but when I get home, I'll put the source in for this.
Cyplesma
 
Posts: 17
Joined: Fri Jan 09, 2004 8:23 pm
Location: USA

Postby Simon_Wolf on Thu Jan 22, 2004 9:37 pm

Thank you for the notes and the pending code.

One further question, however, is how you get a new ID number for a new record. Do you have to read through the database looking for the highest number and then add one to it? Is the database sorted by the ID field (I've still got to look into creating database indexes) so you can go to the last record to get the last used ID? Is there a quick way to jump to the last record?

Sorry that there are so many questions but once I've got my head around this subject I'll try to write a primer for other database newbies.

Simon Wolf
Simon Wolf
Simon_Wolf
 
Posts: 22
Joined: Tue Dec 23, 2003 4:15 pm
Location: United Kingdom

Postby tawilson on Fri Jan 23, 2004 8:43 am

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by Cyplesma</i>
<br />record indexes:

I store a unique number field in the database.

struct ItemRecord {
int RecordID;
string FirstName;
string LastName;
int Age;
}

with orb's list box you do need to display the recordid field in the stringlist. Use a colon or semicolon to separate the fields which you also use to parse from the string later.

list items:
34:Dave Red
478:Gloria Sweet
12:Jessie James

with the above in the list box after you tap on Gloria Sweet, display her name in a text box, display the 478 in a invisible text box, then you read through the database till you find 478 read that record's age field display that in a text box. provide a save button and whenthe user clicks on the save button to save the new age, then use the hidden field with 478 in it to delete that record and write a new record with the new age value. then clear and refill the list box. I'm checking this form from work, but when I get home, I'll put the source in for this.
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

Surely the best way to implement this would be use the struct as above but with the actual record number (if you really need that to quickly find a record) and have a Stringlist just built from the array of your 'struct' (which just contains ONLY the name) and have both of the arrays sorted in the same order and then you can pick them from the list box and get full record details with the
Code: Select all
.selitem
property of the list.

__
/erry
__
/erry
tawilson
 
Posts: 8
Joined: Tue Nov 18, 2003 9:19 am
Location: United Kingdom

Postby Simon_Wolf on Fri Jan 23, 2004 8:55 am

I was thinking of using a two column list with the ID in the first column and the text in the second. The first column could have its width set to zero so that it is effectively hidden whilst the ID is still available via code.

Now if only the Palm OS supported some basic SQL then it would be much quicker and easier to be able to read particular records, update them, performs sorts and filtering, etc. :(

Simon Wolf
Simon Wolf
Simon_Wolf
 
Posts: 22
Joined: Tue Dec 23, 2003 4:15 pm
Location: United Kingdom

Postby tawilson on Fri Jan 23, 2004 9:02 am

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by Simon_Wolf</i>
<br />I was thinking of using a two column list with the ID in the first column and the text in the second. The first column could have its width set to zero so that it is effectively hidden whilst the ID is still available via code.
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

I'm guessing that would be using two lists, one hidden and the other visible and triggered by the popup?

__
/erry
__
/erry
tawilson
 
Posts: 8
Joined: Tue Nov 18, 2003 9:19 am
Location: United Kingdom

Postby Simon_Wolf on Fri Jan 23, 2004 9:15 am

I think that I would use the fake grid system that I posted an example about.

Simon Wolf
Simon Wolf
Simon_Wolf
 
Posts: 22
Joined: Tue Dec 23, 2003 4:15 pm
Location: United Kingdom

Postby Cyplesma on Tue Jan 27, 2004 2:00 pm

Simon,

here's that code I promised ya - finally.

a single database holds all employees

global to project
string currentDepartment;

local to form
StringList NL;

//put the stringlist into the listbox
void LoadNameBox (){
lstNames.setitemslist(NL);
}

//Search through the database for employees in selected
//department and Load the string List
void LoadNL (){
Database db;
DBRecord rec;
int n;
bool bRet = false;
string tempDeptName;

//this is how I finally got the list to clear
for(n=0;LP.count>0;n++){NL.del(0);};
//search through database
if(db.open("pt",false)){
do {
if (db.getrec(n,rec,true)) {
bRet=true;
rec.read(&NameRec, typeof(nameMain), 1);
tempDeptName= PartRec.DeptName;
//if employee department matches currentDepartment
switch (currentDepartment== tempDeptName){;
case true:
//then add to NL stringlist
NL.add(NameRec.RecID + ":" + NameRec.EmpName);
break;
default:
break;
}
rec.close();
n++;
} else {
bRet=false;
}
} while (bRet==true);
}
db.close();
}

//when user taps the lstNames box
//parse the data from the listbox item selected
handler lstNames.onselect() {
string tempstr, tempEmpName;
tempstr = lstNames.gettext(lstNames.selitem);
tempEmpName=strright(tempstr,strlen(tempstr)-(strstr(tempstr,";",strstr(tempstr,":",1))+1));
fldEmpName.text=tempEmpName;
fldIndex.text=strleft(tempstr,strstr(tempstr,":",1));
}


Hope this helps. sorry about the delay.
I recently downloaded the pocketc demo, I'm hoping to create a Table control that I can use via orbforms gadget.
Cyplesma
 
Posts: 17
Joined: Fri Jan 09, 2004 8:23 pm
Location: USA

Postby Simon_Wolf on Sat Jan 31, 2004 10:29 am

Thank you for the code and my apologies for my delay in replying (I've been writing myself some desktop software using PHP and mySQL which has been keeping me off the streets for a few days).

Please also let us all know how you get on with the grid gadget.

Simon

Simon Wolf
Simon Wolf
Simon_Wolf
 
Posts: 22
Joined: Tue Dec 23, 2003 4:15 pm
Location: United Kingdom

Postby Cyplesma on Sun Oct 30, 2005 12:49 am

well I didn't do a grid gadget.

I use an array variable of the dbstruct and include the database record id.

the scroll control uses the index of the array, and I store the dbrecord index in the array (but not the array pointer, that's for the scroll control) to get to the right record to update.

I toyed with trying to do this with the gadget but I just don't get the gadgets.....yet.
Cyplesma
 
Posts: 17
Joined: Fri Jan 09, 2004 8:23 pm
Location: USA


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 2 guests

cron