When you click on a Button DataWindowObject (DWObject, or DWO) in a DataWindow, the ButtonClicked event in the DataWindow Control is going to fire. The "row" and "dwo" arguments to that event are supplied by PB. If the clicked button DWO resides in a Group trailer band (regardless of whether it is Group 1, 2, 3, etc.) the row argument will be the row number of the last row in that group. The Name property of the DWObject event argument dwo (i.e., dwo.Name) will identify the name of the button DWObject that was clicked.
If you instead click on something other than a Button DWObject, the Clicked event in the DataWindow Control is going to fire. This event also has a Long argument value named "row" and a DWObject argument named "dwo". If the DWObject resides in a Group trailer band, the row argument will be the row number of the last row in that group and dwo.Name will tell you the name of the DWObject that the user clicked. If the clicked object resides in a Group header band, the row argument will be the row number of the first row in that group.
If you click in a DataWindow but do not happen to click on any DWObject, the row number in the event will be zero and the dwo.Name will be "datawindow".
Regardless, once you have the row number, you can access the data values in that row using the GetItemXXXXXX methods, as Mike described.
I suggest you put the following code in the Clicked and/or ButtonClicked event of a DWC and experiment a little to get more comfortable with these events and the argument values that are passed to them:
MessageBox('Test','Row: '+String(row)+'~r~nObject Name: '+dwo.Name)
HTH
Regards, John