BoundField update...

Creating and using forms
Post Reply
mogua
Posts: 12
Joined: Wed Apr 15, 2009 8:17 pm

BoundField update...

Post by mogua »

I'm not sure if this is possible. So far it doesn't seem so!

I have a data-aware Form with a Table Control and a Text Box. As the user selects a cell in the Table Control, I would like to update the Text Box to permit the user to view the contents of the selected cell in an "expanded" view. Thus far, I have used the following code to set the DataField property of the Text Box's model. But it appears that the BoundField property (references the Column in the Form to which the DataField originally referred) does not get updated automatically. Am I doing something wrong?

Code: Select all

'PURPOSE.........To update the fieldTxtBx to match the column selected
'AUTHOR..........James Wilmoth (...@gmail.com)
'DATE MODIFIED...2009-05-10
SUB communicationsTblCtrl_MOUSE_BUTTON_RELEASED(EVENT AS OBJECT)

'1. GET THE COLUMN.

	source = event.source
	currentColumnPosition = source.CurrentColumnPosition
	form = Utilities.getParentForm(source)
	column = form.Columns.getByIndex(currentColumnPosition)
	
'2. UPDATE THE DATAFIELD.

	model = form.getByName("fieldTxtBx")
	model.DataField = column.name
	
'3. RELOAD THE CONTROL.

	'Not sure what to do here to refresh model.BoundField
	
END SUB
OOo 3.1.X on Ms Windows XP + openSuse 11
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: BoundField update...

Post by Villeroy »

Use a subform with a text box. Bind the subform to SELECT "ID","Text" FROM "Same Table" on the one side and to the common ID of the same table on the other side. Add the text box to the subform and bind it to the "text" field.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply