Le 22/02/10 05:49, Jay Reeve a écrit : > Hi, > > I now have my data showing as I wish in a list view DB. I can select a > data row by clicking on it. I've searched the docs for hours to find how > I can get it to let me edit the text, but have found nothing. It sounds > as if it should be automatic (I've set them to editable in IB), but it > doesn't work. I don't need (I hope) a full demo, but if someone could > point me in the right direction I'd be grateful. I know I'll need a > callback to deal with the changed data, but first I have to get an edit > field, don't I? > Hi Jay, The callback function you need is your GetSetItemData function. For sure it is not obvious, but when you set up the editable property at creation time it is done for the entire column regardless of the individual items that it will hold later. You may wish to allow editing or not for specific items in that column for whatever reason in your program. In the GetSetItemData callback you must tell the DataBrowser if the item currently examined can be edited. I suppose the DataBrowser asks that information for each item sitting in an editable column. The GetSetItemData callback is used also to let you know when a cell's content has been changed by the end user for a specific item. It's time to retrieve that information and to accept or not the modification, then possibly update your internal data to reflect that change. You'll probably need the GetDataBrowserItemDataText Toolbox function to pick up the edited text, so here is a sketch (caution, it may be buggy): Local Fn MyGetSetItemData( browser As ControlRef, ¬ itemID As DataBrowserItemID, ¬ theProperty As DataBrowserPropertyID, ¬ itemData As DataBrowserItemDataRef,¬ setValue As Boolean ) Dim err As OSStatus : err = _errDataBrowserPropertyNotSupported dim newTxt As CFStringRef Dim myString As Str255 Long If setValue = _false Select theProperty Case _kDataBrowserItemIsEditableProperty // we must tell the DataBrowser that the item under examination // can be edited (check certain condition if necessary) err = Fn SetDataBrowserItemDataBooleanValue( itemData, _true ) End Select Xelse // We are informed that the cell's content has changed // it's time to grab it. Select theProperty Case _"xxxx" // your editable column ID Long If Fn GetDataBrowserItemDataText( itemData, newTxt ) = _noErr Long If newTxt err = Fn CFStringGetPascalString(newTxt, myString, 256, _kCFStringEncodingMacRoman ) Call CFRelease( newTxt ) Long If err = _noErr // update your internal data here with myString End If End If End If End Select End If End Fn = err > Also, I have my columns set for variable width, but when I attempt to > change the width with the mouse, the data display gets trashed. Do I > need a callback for that, too? What should it do? > I don't know exactly what you mean by "get trashed". Perhaps you can try: err = Fn UpdateDataBrowserItems( browser, _kDataBrowserNoItem, 0, #_kDataBrowserNoItem, _kDataBrowserItemNoProperty, _kDataBrowserNoItem ) or maybe: Call DrawOneControl( browser ) If the problem is not fixed then, perhaps, it resides in your GetSetItemData callback function. > Is there a simple way to eliminate the disclosure triangle space at the > left of each column, so I can make better use of the space? (I'm not > using the triangles here.) > See DataBrowserSetMetric in Tlbx ControlDefinitions.incl header file, there's some useful documentation left in that file. Cheers, Alain