Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Listbox
Message
From
26/12/2000 23:38:56
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00456828
Message ID:
00456970
Views:
26
>>>How can I add extra new rows in the listbox when is populated from a table (alias)?
>
>>In addition to what Ko answered, if you do not want to change table, you require to read table into listbox manually in the loop through table records using AddListItem and AddItem methods of listbox. Than you will be able to do anything with listbox items. You can try to use these methods with table too (I hope this works), but any requery of listbox will require to add these items again.

> Even when you want to modify the table, you can still use it as the RecordSource, turning buffering to 5. When you're done using it, just drop the changes with TableRevert().

Another option is to have a separate cursor with just the fields we need appended from the table, and the additional records added, i.e.
[this code best fits form.init - tables are already open, listbox exists]
create cursor ForListbox (cCode c(4), cName c(40))
append fields cCode, cName from TheTable   && for ... expression
insert into ForListBox (cCode, cName) values ('X001','[add new]')
insert into ForListBox (cCode, cName) values ('X002','[delete all]')
with thisform.[full containership path here].listbox
   .rowsourcetype=6
   .rowsource='forlistbox.cName,cCode'
   .boundcolumn=2
   .columnwidths="["+tran(.width)+",0]"
endwith
Any additions to this cursor may or may not be echoed into the original table, depending on the programmer's decision, i.e. he's in charge here.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform