RecID field

Sims, John ayu8 at cdc.gov
Tue May 3 12:53:16 CDT 2005


> -----Original Message-----
> From: valentina-bounces at lists.macserve.net 
> [mailto:valentina-bounces at lists.macserve.net] On Behalf Of 
> Jules Jacquot
> Sent: Tuesday, May 03, 2005 12:30 PM
> To: Valentina Developers
> Subject: Re: RecID field
> 
> 
> 
> Le 3 mai 05 à 09:11, Ruslan Zasukhin a écrit :
> 
> > On 5/3/05 8:30 AM, "Jules Jacquot" <jules.jacquot at wanadoo.fr> wrote:
> >
> > Hi Jules,
> >
> >
> >> hi, Ruslan
> >>
> >> with API_way
> >>
> >> how can i see the field RecID of a record on the listbox ?
> >>
> >> so, how can i select it ?
> >>
> >
> > Just get it from table:
> >
> >     f = Table.Field( "RecID" )
> 
> well. to be clear here is what i want
> 
> valentina populates 10 records on the listbox ( i find that that is  
> too slow. But this is another problem )
> 
> to select one row by cellclick
> 
> i would like to extract the RecID from this record selected for some  
> operations with it.
> 
> how ?
> 
> thanks
> 
> jules
> >

Hi Jules,

If this is REALbasic then the ListBox has a CellTag property {CellTag(row,column)}.  When you populate your listbox, populate the CellTag property (since you are only interested in the value for each row, I would set column=0).  Here's some example code...

  dim myVTable As myVTableClass
  dim oAll As VBitSet
  dim oSort As VArraySet
  dim siIterate As VSetIterator
  dim iRecID As Integer
  
  myVTable = myVDatabase.myVTable
  
  oAll = myVTable.SelectAllRecords
  oSort = myVTable.Sort(oAll, myVTable.vdfDisplayOrder)
  
  siIterate = oSort.MakeNewIterator
  iRecID = siIterate.FirstItem
  do until iRecID = 0
    myVTable.RecID = iRecID
    myListBox.AddRow(myVTable.vdfName.GetString)
    myListBox.CellTag(myListBox.ListCount - 1,0) = iRecID
    iRecID = siIterate.NextItem
  loop


To pull the RecID for the selected row, you would simply say...

iRecID = myListBox.CellTag(myListBox.ListIndex,0)

This is off the top of my head, so I apologize if I typo'd somewhere, but I think it will give you a good feel for how to use the CellTag.

HTH,

-John


More information about the Valentina mailing list