With the following code I can read out the name of a mesh data block.
row.prop(obj, "data")
And with the following code I can read out the name of the object.
row.prop(obj, "name")
But I noticed that I cannot edit the mesh data name only the object name.
Here is the code from Blender that generated the mesh data block UI.
class DATA_PT_context_mesh(MeshButtonsPanel, Panel):
bl_label = ""
bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
ob = context.object
mesh = context.mesh
space = context.space_data
if ob:
layout.template_ID(ob, "data")
elif mesh:
layout.template_ID(space, "pin_id")